FHIR Chat · exit code validator · implementers

Stream: implementers

Topic: exit code validator


view this post on Zulip Hans van Amstel (Jul 02 2020 at 12:44):

I am using the validator(5.0.7) to validate a folder of FHIR profiles as part of our build pipeline. Success of the build depends on the exit code of the validator.

Validation errors set the exit code to !=0 what means an error this also shows in the output of the validator. This is ok as an error was found and our build fails.
But during validation the validator tries to make snapshots ( I do not use the -snapshot argument). The creation of these snapshots fails in this case due to "is not a valid constraint on the base". But after this failure the validator continues and validation of the same profile succeeds without any error, warning or info.

1)Should the exit code of the validator not indicates an error after snapshot generation fails during validation? Meaning being set to anything !=0.
2)It is strange to me that validation of a profile can succeed even when the snapshot generation for the same profile during the validation fails.

I see the same behavior of the validator for R4 and STU3

view this post on Zulip Grahame Grieve (Jul 02 2020 at 13:24):

hmm. the trouble is that I may not know whether the snapshot that failed is critical for the outcome.

view this post on Zulip Grahame Grieve (Jul 02 2020 at 13:25):

can you give me a nice precise set up that I can add as a test case that reproduces your scenario?

view this post on Zulip Hans van Amstel (Jul 02 2020 at 16:01):

@Grahame Grieve I have send the profiles and the commands used via mail. It will have the same result as shown below.

Detected Java version: 13.0.1 from /usr/java/openjdk-13 on amd64 (64bit). 4012MB available
Arguments: SkinQuestionnaireResponse.structuredefinition.xml -version 3.0 -ig /usr/data/npmpackage/package -ig hl7.fhir.uv.sdc#2.0.0 -recurse
Directories: Current = /usr/data/npmpackage/package, Package Cache = /home/tfsagent/.fhir/packages
 .. FHIR Version 3.0, definitions from hl7.fhir.r3.core#3.0.2
 .. connect to tx server @ http://tx.fhir.org
 (v3.0.2)
+ .. load IG from /usr/data/npmpackage/package
+ .. load IG from hl7.fhir.uv.sdc#2.0.0
 .. validate [SkinQuestionnaireResponse.structuredefinition.xml]
Unable to generate snapshot for SkinQuestionnaireResponse from ILS-QuestionnaireResponse because Profile SkinQuestionnaireResponse (https://www.fhir.philips.com/3.0/StructureDefinition/personalHealth/skin/skinIssueQuestionnaire-v1/SkinQuestionnaireResponse), element QuestionnaireResponse.questionnaire. Error generating snapshot: The target profile https://www.fhir.philips.com/3.0/StructureDefinition/common/resource/general/questionnaireResponse-v1/ILS-QuestionnaireResponse is not a valid constraint on the base ([CanonicalType[http://hl7.org/fhir/StructureDefinition/Questionnaire]]) at QuestionnaireResponse.questionnaire
org.hl7.fhir.exceptions.DefinitionException: Profile SkinQuestionnaireResponse (https://www.fhir.philips.com/3.0/StructureDefinition/personalHealth/skin/skinIssueQuestionnaire-v1/SkinQuestionnaireResponse), element QuestionnaireResponse.questionnaire. Error generating snapshot: The target profile https://www.fhir.philips.com/3.0/StructureDefinition/common/resource/general/questionnaireResponse-v1/ILS-QuestionnaireResponse is not a valid constraint on the base ([CanonicalType[http://hl7.org/fhir/StructureDefinition/Questionnaire]]) at QuestionnaireResponse.questionnaire
    at org.hl7.fhir.r5.context.SimpleWorkerContext.generateSnapshot(SimpleWorkerContext.java:675)
    at org.hl7.fhir.r5.context.SimpleWorkerContext.generateSnapshot(SimpleWorkerContext.java:646)
    at org.hl7.fhir.r5.context.SimpleWorkerContext.allStructures(SimpleWorkerContext.java:529)
    at org.hl7.fhir.validation.ValidationEngine.prepare(ValidationEngine.java:1315)
    at org.hl7.fhir.validation.cli.services.ValidationService.validateSources(ValidationService.java:53)
    at org.hl7.fhir.validation.Validator.main(Validator.java:202)
Success...validating SkinQuestionnaireResponse.structuredefinition.xml: error:0 warn:0 info:0```

view this post on Zulip Grahame Grieve (Jul 03 2020 at 00:04):

yes I thought this one wouldn't be easy to fix. The unable to generate... message is not germane to the outcome of the validation, so it doesn't feature in the exit code

view this post on Zulip Hans van Amstel (Jul 03 2020 at 09:03):

@Grahame Grieve Thanks for looking into it. Is this something that will be fixed so that I get an error exit code. Or maybe add an additional strictness argument for setting a strictness level that when set to the max will have all these generation errors and the warnings set an error exit code.

view this post on Zulip Grahame Grieve (Jul 03 2020 at 09:37):

well, I worked more on validation of profiles (as opposed to validation by profiles) and you'll get both an error and a exit code from the next release

view this post on Zulip Hans van Amstel (Jul 03 2020 at 09:39):

@Grahame Grieve Thanks a lot. Looking forward to integrating and using it.


Last updated: Apr 12 2022 at 19:14 UTC