Releases: EMBL-EBI-SUBS/json-schema-validator
Better validation output
Compact validation output
Before this version, validation errors referring to the same input were displayed individually, such as:
[
{
"errors": [
"should NOT be shorter than 1 characters"
],
"dataPath": ".attributes['asdasda'][0].terms[0].url"
},
{
"errors": [
"should match format \"uri\""
],
"dataPath": ".attributes['asdasda'][0].terms[0].url"
}
]
From 1.2.0
the same errors showed above are now displayed in the same error object. For each input there will only be one error object with one or more error messages, example bellow:
[
{
"errors": [
"should NOT be shorter than 1 characters",
"should match format \"uri\""
],
"dataPath": ".attributes['breed'][0].terms[0].url"
}
]
Fix dependency version due to vulnerability
Merge pull request #7 from EMBL-EBI-SUBS/SUBS-1271-error-output Fix dependency version due to detected vulnerability
Better validation output
Changes to the Validation Output
A valid output from a validation request will produce a response like:
HTTP status code 200
[]
An invalid output form a validation request will look like:
HTTP status code 200
[
{
"errors": [
"should have required property 'value'"
],
"dataPath": ".attributes['age'][0].value"
}
]
Where errors is an array of error messages for a given input identified by its path in dataPath. There may be one or more error objects within the response array. An empty array represents a valid validation result.
Proof of concept
This is the first release of USI's json-schema-validator. It is intended as a proof of concept for a meta-data rule based validator to be adopted by the USI project.
The server exposes one endpoint: /validate
, it accepts a schema and an object to be validated against the provided schema. The POST
request body should be structured like this:
{
"schema": {},
"object": {}
}
Besides all the keywords available in JSON schema draft-07 we implemented a custom one: isChildTermOf
. For more details on this, see the README file.