I’m using JSON Schema to validate a json object like below:
{
"json":
{ "is_expanded_identification": false, "identity":
{ "concat_id": 44446543R, "concat_id_type_code": 1 }
}
,
"study_year": "2025"
}
Here is my Json Schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [
"json",
"study_year"
],
"properties": {
"json": {
"type": "object",
"required": [
"is_expanded_identification",
"identity"
],
"properties": {
"is_expanded_identification": {
"type": "boolean"
},
"identity": {
"type": "object",
"required": [
"concat_id",
"concat_id_type_code"
],
"properties": {
"concat_id": {
"type": "integer",
"errorMessage": {
"type": "My custom messsage"
}
},
"concat_id_type_code": {
"type": "integer"
}
}
}
}
},
"study_year": {
"type": "string",
"pattern": "^\d{4}$"
}
}
}
I would expect it to show my custom message because of the “contact_id” field R letter,
Instead it show the JSchema default message “Unexpected character encountered while parsing number: R.”.
I’v tried “errorMessage”/’message” but none of them worked for me.
Isn’t it support with Json SChema Validations of newtosoft?