I need to implement schema validation for incoming JSON payload.
The below elements will be there in the JSON,
"partyId": {
"type": ["string","null"],
"maxLength": 16,
"required": false,
"description": "Party ID"
},
"erpId": {
"type": ["string","null"],
"maxLength": 20,
"required": false,
"description": "ERP ID"
}
Required validation : Any one element should be available in JSON, Else it should reject the request.
My project is using "$schema":"http://json-schema.org/draft-06/schema#"
Some follow up question?
- How to find which schema draft version using in my project (some schema json file there is no draft version in the top)?
- Which maven dependency is supporting this schema draft version ?