I am validating a FHIR resource using ajv.
ajv -s fhir.schema.json -d SampleOperationOutCome.json
This is the SampleOperationOutCome.json file
{
"resourceType": "OperationOutcome",
"id": "101",
"text": {
"status": "additional",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>text.<\/p><\/div>"
},
"issue": [
{
"severity": "error",
"codeerror": "invalid",
"details": {
"coding": [
{
"system": "http://hl7.org/fhir/operation-outcome",
"code": "MSG_CANT_PARSE_CONTENT"
}
],
"text": "text"
}
}
]
}
You can get the json schema from FHIR build 3.4 json schemas
My main challenge when validating is to understand which is really the source issue. For example, in this case I've change de "code" field to "codeerror", but when validating I get mainly a list of the following error:
{ keyword: 'additionalProperties',
dataPath: '',
schemaPath: '#/additionalProperties',
params: { additionalProperty: 'issue' },
message: 'should NOT have additional properties' },
I do know if it is the normal output, or if the source of this behaviour is the json schema or ajv, but I would expect some message like "invalid field codeerror, one of code expected".
Any suggestion in order to be able do analyse the full output and get the real source?
Thanks.