I am trying to validate my JSON using ( https://github.com/fge/json-schema-validator) schema validator.
Do you recommend using jackson schema generation to generate JSON schemas or is there a better way ?
I have an object called (Location) which has list of objects (BaseObject). I created a schema for location like this with a $ref to BaseObject. But validation fails with the error message - ["": domain: validation; keyword: properties; message: required property(ies) not found; missing: ["id","refName"]; required: ["id","refName"]]
Is there a mistake in the way I used the refs ?
Location.json - schema
{
"type":"object",
"properties":{
"locationType":{
"type":"string"
},
"mapsRefs":{
"$ref": "file://localhost/c:/baseobject.json"
}
}
}
}
baseobject.json - schema
{
"type":"object",
"properties":{
"refName":{
"type":"string",
"required":true
},
"id":{
"type":"integer",
"required":true
},
"refs":{
"type":"array",
"required":false,
"items":{
"type":"string"
}
}
}
}