Closed ghost closed 6 years ago
We have just switched to using the R4 validator (with its many fixes) for validating DSTU3 resources, and I have confirmed that this now works as expected. See test in above commit.
Can we switch to R4 validator without changing our profiles and app to support R4?
You don't need to change anything, HAPI will automatically use the R4 validator to validate your DSTU3 resources as of 3.3.0. It up-converts any StructureDefinitions, ValueSets, and CodeSystems it needs to fetch in order to do the validation.
@jamesagnew Just to be clear:
If we use the R4 validator do the FHIR resources stored to our server need to conform to R4 or can they still be STU3? You mention up-converting profile resources but we are currently STU3 compliant.
I see that I have to refer to the R4 versions of the structures and the validator doesn't like the STU3 FhirContext.
We have the following extension in our profile: https://simplifier.net/FinnishPHR/fiphr-medicationcontext
the valueCodeableConcept element is bound with the 'required' modifier.
We have this extension in our resource:
The value "13" is not in the valuesystem that the extension is bound to: https://simplifier.net/FinnishPHR/fiphr-vs-medicationcontext
Nevertheless, the resource passes Hapi's validation. I presume part of the reason is the following code which doesn't take into account if the binding is required, extensible or something else. Though I cannot be sure if it is checked in some other part of the implementation. https://github.com/jamesagnew/hapi-fhir/blob/d375977410f98cd6de44ef64a902d9769a4c3d97/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/DefaultProfileValidationSupport.java#L254
Here's the complete profile used: https://simplifier.net/FinnishPHR/fiphr-pef-stu3
Here's the resource we are validating: