0
votes

Trying to use MarkLogic's xdmp:json-validate to validate instances of FHIR-formatted resources against the published FHIR JSON Schema that I have loaded into my Schemas database. When there is an invalid element, my output in query console is always the same:

[1.0-ml] XDMP-JINVNODE: oneOf fn:doc("/documents/examples/ml_loaded_member_1.json")/object-node() "fhir.schema.json" {...}

where {...} appears to be a complete dump of the huge schema.

How can I get a meaningful message indicating the exact schema validation error?

UPDATE: After a bit more research into general validation using json schema, I'm assuming this issue is related to the use of the "discriminator/propertyName" keyword in the FHIR schema. That keyword value ("resourceType") informs validators how to determine which definition ("Patient" in my example) to validate against. I suspect that is not well supported, so the error report lists all definitions in the schema to which the given node does not conform. (or something like that)

1
When did you grab the schemas? They were updated in the last week to R4. It'll be important to anyone helping you to know if you're using the ones that are currently there or the ones that used to be there and are now at hl7.org/fhir/stu3/validation.html#json-schemaLloyd McKenzie
I have loaded the 3.3 fhir schema, but the version should not matter, just trying to understand how to get meaningful validation error messaging. Thanks.Paulwms
If the problem still exists in the R4 release, please let us know.Lloyd McKenzie
Loaded FHIR R4 schema, same problemPaulwms
Have you looked into this library npmjs.com/package/great-json-validator ?Carlino Gonzalez

1 Answers

2
votes

It looks like there is a missing error definition, so you aren't getting the formatted error message. For what it's worth, the "oneOf" is telling you that that is the constraint that failed and the second thing there is the path to the node that failed the constraint. We're still working on improving some of the error reporting: bug reports via support would be helpful.