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
will give the following results - depending on which PathType is used
response using PathType.JSON_POINTER
{
"validationMessages": [
{
"schemaPath": "#/properties/meta/required",
"message": "/meta.officialRating: is missing but it is required",
"path": "/meta",
"arguments[0]": "officialRating"
},
{
"schemaPath": "#/definitions/rating/enum",
"message": "/meta/rating: does not have a value in the enumeration [R, PG-13, PG, G]",
"path": "/meta/rating",
"arguments[0]": null
},
{
"schemaPath": "#/properties/meta/properties/label/minLength",
"message": "/meta/label: must be at least 2 characters long",
"path": "/meta/label",
"arguments[0]": null
},
{
"schemaPath": "#/properties/meta/properties/tags/items/enum",
"message": "/meta/tags/0: does not have a value in the enumeration [action, comedy, drama, fantasy]",
"path": "/meta/tags/0",
"arguments[0]": null
}
]
}
response using PathType.JSON_PATH or PathType.JSON_LEGACY
{
"validationMessages": [
{
"schemaPath": "#/properties/meta/required",
"message": "$.meta.officialRating: is missing but it is required",
"path": "$.meta",
"arguments[0]": "officialRating"
},
{
"schemaPath": "#/definitions/rating/enum",
"message": "$.meta.rating: does not have a value in the enumeration [R, PG-13, PG, G]",
"path": "$.meta.rating",
"arguments[0]": null
},
{
"schemaPath": "#/properties/meta/properties/label/minLength",
"message": "$.meta.label: must be at least 2 characters long",
"path": "$.meta.label",
"arguments[0]": null
},
{
"schemaPath": "#/properties/meta/properties/tags/items/enum",
"message": "$.meta.tags[0]: does not have a value in the enumeration [action, comedy, drama, fantasy]",
"path": "$.meta.tags[0]",
"arguments[0]": null
}
]
}
in some cases path points to the expected error field - but for instance when the ValidatorTypeCode is either ADDITIONAL_PROPERTIES or REQUIRED then the corresponding field can be found in arguments[0] and is not part of the path itself.
however - when looking at the message it does look like it's always "pointing" to the expected error field .
is there any way to get the "full path" - other than parsing the message ?
on that note - could it be that this /meta.officialRating is not intended ?
couldn't find anything regarding dots in json pointer, see rfc6901
@peter-ponzel Good observations. The validation messages could definitely be improved and we have other requests including one to implement the format described in the JSON Schema specification.
I'm currently focused on ensuring complete coverage of the specification so I have not addressed these yet. Pull-requests are welcome.
hello,
this issue has already been raised before → #615 unfortunately it was not really solved.
using the following json and json-schema
json.json
schema.json
will give the following results - depending on which
PathType
is usedresponse using PathType.JSON_POINTER
response using PathType.JSON_PATH or PathType.JSON_LEGACY
in some cases
path
points to the expected error field - but for instance when theValidatorTypeCode
is eitherADDITIONAL_PROPERTIES
orREQUIRED
then the corresponding field can be found inarguments[0]
and is not part of thepath
itself.however - when looking at the
message
it does look like it's always "pointing" to the expected error field .is there any way to get the "full path" - other than parsing the
message
?on that note - could it be that this
/meta.officialRating
is not intended ?couldn't find anything regarding dots in json pointer, see rfc6901
best regards,
peter
environement
openjdk 17.0.7 2023-04-18
com.networknt:json-schema-validator:1.0.84
The text was updated successfully, but these errors were encountered: