You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 23, 2024. It is now read-only.
Currently, CAM-KP-API decodes the TRAPIRequest in a non-strict manner: we do not throw an error if required properties are not included, if properties are incorrectly named, or if additional properties are added (as is allowed on several entities, including QNode and QEdge). While we can check for required properties by throwing an error if they are missing, incorrectly named properties are simply ignored; this is a violation of the TRAPI 1.3. specification, which requires that CAM-KP-API should generate a warning. The only way to report an error with these properties would be by adding a DecodeFailureHandler that can catch these errors and return the correct TRAPIResponse.
This is partially implemented in PR #560; however, there are two remaining issue to fix.
This allows us to define a BiolinkPredicate as either a single term (which is then separated into a shorthand and IRI) or as a shorthand/IRI pair. This allows a BiolinkPredicate to be defined in a TRAPIQuery as a single string, which is then converted internally into a BiolinkPredicate. Unfortunately, when strictDecoding is using, this causes validation to fail when the supplied BiolinkPredicate does not contain both shortname and iri properties, which isn't actually in the TRAPI specification.
There are several possible fixes; probably the simplest would be to specifically recognize these errors and -- if no other validation errors occur -- to silently discard them. But they do need to be fixed in some way.
Currently, CAM-KP-API decodes the TRAPIRequest in a non-strict manner: we do not throw an error if required properties are not included, if properties are incorrectly named, or if additional properties are added (as is allowed on several entities, including QNode and QEdge). While we can check for required properties by throwing an error if they are missing, incorrectly named properties are simply ignored; this is a violation of the TRAPI 1.3. specification, which requires that CAM-KP-API should generate a warning. The only way to report an error with these properties would be by adding a
DecodeFailureHandler
that can catch these errors and return the correct TRAPIResponse.This is partially implemented in PR #560; however, there are two remaining issue to fix.
400 Bad Request
if the TRAPI request is understandable but contains fields that we don't understand. PR Test for unrecognized properties on QNode and QEdge #560 currently return a400 Bad Request
if there are additional properties in QNode or QEdge.shortname
andiri
fields to pass validation (see below).BiolinkPredicate/BiolinkClass currently require both
shortname
andiri
fields to pass validationBiolinkPredicate is defined in the domain/package.scala as:
cam-kp-api/src/main/scala/org/renci/cam/domain/package.scala
Lines 93 to 121 in 82ca402
This allows us to define a BiolinkPredicate as either a single term (which is then separated into a shorthand and IRI) or as a shorthand/IRI pair. This allows a BiolinkPredicate to be defined in a TRAPIQuery as a single string, which is then converted internally into a BiolinkPredicate. Unfortunately, when strictDecoding is using, this causes validation to fail when the supplied BiolinkPredicate does not contain both
shortname
andiri
properties, which isn't actually in the TRAPI specification.There are several possible fixes; probably the simplest would be to specifically recognize these errors and -- if no other validation errors occur -- to silently discard them. But they do need to be fixed in some way.
The same issue also applies to BiolinkClass:
cam-kp-api/src/main/scala/org/renci/cam/domain/package.scala
Lines 74 to 91 in 82ca402
The text was updated successfully, but these errors were encountered: