From 30cf201b32dd06413656dc7f87d0362fb885386d Mon Sep 17 00:00:00 2001 From: "dotasek.dev" Date: Mon, 16 Sep 2024 13:02:47 -0400 Subject: [PATCH 1/4] org.hl7.fhir.core bump 6.3.25 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a7cae721347..c8a2e2f5049 100644 --- a/pom.xml +++ b/pom.xml @@ -948,7 +948,7 @@ - 6.3.23 + 6.3.25 2.41.1 -Dfile.encoding=UTF-8 -Xmx2048m From df77506bf7eaffeb546779d8322a326bff4d45c5 Mon Sep 17 00:00:00 2001 From: dotasek Date: Mon, 16 Sep 2024 15:39:27 -0400 Subject: [PATCH 2/4] Add setting for UnknownCodeSystemsCauseErrors + fix tests --- .../jpa/dao/r4/FhirResourceDaoR4ValidateTest.java | 6 +++--- .../validation/validator/FhirInstanceValidator.java | 12 ++++++++++++ .../hapi/validation/validator/ValidatorWrapper.java | 8 ++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java index 3de4d680d9d..65eb5737e2b 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java @@ -228,7 +228,7 @@ public void testValidateCodeInEnumeratedValueSetWithUnknownCodeSystem_Warning() encoded = encode(oo); ourLog.info(encoded); assertThat(oo.getIssue()).hasSize(1); - assertEquals("CodeSystem is unknown and can't be validated: http://cs for 'http://cs#code1' (error because this is a required binding)", oo.getIssueFirstRep().getDiagnostics()); + assertEquals("CodeSystem is unknown and can't be validated: http://cs for 'http://cs#code1'", oo.getIssueFirstRep().getDiagnostics()); assertEquals(OperationOutcome.IssueSeverity.WARNING, oo.getIssueFirstRep().getSeverity()); // Invalid code @@ -334,7 +334,7 @@ public void testValidateCodeInNonEnumeratedValueSetWithUnknownCodeSystem_Warning encoded = encode(oo); ourLog.info(encoded); assertThat(oo.getIssue()).hasSize(1); - assertEquals("CodeSystem is unknown and can't be validated: http://cs for 'http://cs#code1' (error because this is a required binding)", oo.getIssueFirstRep().getDiagnostics()); + assertEquals("CodeSystem is unknown and can't be validated: http://cs for 'http://cs#code1'", oo.getIssueFirstRep().getDiagnostics()); assertEquals(OperationOutcome.IssueSeverity.WARNING, oo.getIssueFirstRep().getSeverity()); // Invalid code @@ -343,7 +343,7 @@ public void testValidateCodeInNonEnumeratedValueSetWithUnknownCodeSystem_Warning encoded = encode(oo); ourLog.info(encoded); assertThat(oo.getIssue()).hasSize(1); - assertEquals("CodeSystem is unknown and can't be validated: http://cs for 'http://cs#code99' (error because this is a required binding)", oo.getIssue().get(0).getDiagnostics()); + assertEquals("CodeSystem is unknown and can't be validated: http://cs for 'http://cs#code99'", oo.getIssue().get(0).getDiagnostics()); assertEquals(OperationOutcome.IssueSeverity.WARNING, oo.getIssue().get(0).getSeverity()); } diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirInstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirInstanceValidator.java index 70af4473f18..ad5c78bc428 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirInstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirInstanceValidator.java @@ -35,6 +35,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta private boolean noBindingMsgSuppressed = false; private volatile VersionSpecificWorkerContextWrapper myWrappedWorkerContext; private boolean errorForUnknownProfiles = true; + private boolean myUnknownSystemsCauseErrors = true; private boolean assumeValidRestReferences; private List myExtensionDomains = Collections.emptyList(); private IValidatorResourceFetcher validatorResourceFetcher; @@ -132,6 +133,14 @@ public void setBestPracticeWarningLevel(BestPracticeWarningLevel theBestPractice myBestPracticeWarningLevel = theBestPracticeWarningLevel; } + public void setUnknownSystemsCauseErrors(boolean theUnknownSystemsCauseErrors) { + myUnknownSystemsCauseErrors = theUnknownSystemsCauseErrors; + } + + public boolean isUnknownSystemsCauseErrors() { + return myUnknownSystemsCauseErrors; + } + /** * Returns the {@link IValidationSupport validation support} in use by this validator. Default is an instance of * DefaultProfileValidationSupport if the no-arguments constructor for this object was used. @@ -229,6 +238,7 @@ protected List validate(IValidationContext theValidationCt .setAnyExtensionsAllowed(isAnyExtensionsAllowed()) .setBestPracticeWarningLevel(getBestPracticeWarningLevel()) .setErrorForUnknownProfiles(isErrorForUnknownProfiles()) + .setUnknownSystemsCauseErrors(isUnknownSystemsCauseErrors()) .setExtensionDomains(getExtensionDomains()) .setValidationPolicyAdvisor(validatorPolicyAdvisor) .setNoTerminologyChecks(isNoTerminologyChecks()) @@ -239,6 +249,8 @@ protected List validate(IValidationContext theValidationCt .validate(wrappedWorkerContext, theValidationCtx); } + + @Nonnull protected VersionSpecificWorkerContextWrapper provideWorkerContext() { VersionSpecificWorkerContextWrapper wrappedWorkerContext = myWrappedWorkerContext; diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java index c5ed37b5519..ac17c300554 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java @@ -47,6 +47,7 @@ class ValidatorWrapper { private boolean myAssumeValidRestReferences; private boolean myNoExtensibleWarnings; private boolean myNoBindingMsgSuppressed; + private boolean myUnknownSystemsCauseErrors; private Collection myExtensionDomains; private IValidatorResourceFetcher myValidatorResourceFetcher; private IValidationPolicyAdvisor myValidationPolicyAdvisor; @@ -82,6 +83,11 @@ public ValidatorWrapper setErrorForUnknownProfiles(boolean theErrorForUnknownPro return this; } + public ValidatorWrapper setUnknownSystemsCauseErrors(boolean theUnknownSystemsCauseErrors) { + myUnknownSystemsCauseErrors = theUnknownSystemsCauseErrors; + return this; + } + public ValidatorWrapper setNoTerminologyChecks(boolean theNoTerminologyChecks) { myNoTerminologyChecks = theNoTerminologyChecks; return this; @@ -129,6 +135,7 @@ public List validate( v.setResourceIdRule(IdStatus.OPTIONAL); v.setNoTerminologyChecks(myNoTerminologyChecks); v.setErrorForUnknownProfiles(myErrorForUnknownProfiles); + v.setUnknownCodeSystemsCauseErrors(myUnknownSystemsCauseErrors); v.getExtensionDomains().addAll(myExtensionDomains); v.setFetcher(myValidatorResourceFetcher); v.setPolicyAdvisor(myValidationPolicyAdvisor); @@ -136,6 +143,7 @@ public List validate( v.setNoBindingMsgSuppressed(myNoBindingMsgSuppressed); v.setAllowXsiLocation(true); + List messages = new ArrayList<>(); List profiles = new ArrayList<>(); From 6dad5f66c638333a33ee8f69790d7d1250d63b6e Mon Sep 17 00:00:00 2001 From: dotasek Date: Mon, 16 Sep 2024 16:12:46 -0400 Subject: [PATCH 3/4] Spotless --- .../common/hapi/validation/validator/FhirInstanceValidator.java | 2 -- .../fhir/common/hapi/validation/validator/ValidatorWrapper.java | 1 - 2 files changed, 3 deletions(-) diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirInstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirInstanceValidator.java index ad5c78bc428..09dd738a9b7 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirInstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirInstanceValidator.java @@ -249,8 +249,6 @@ protected List validate(IValidationContext theValidationCt .validate(wrappedWorkerContext, theValidationCtx); } - - @Nonnull protected VersionSpecificWorkerContextWrapper provideWorkerContext() { VersionSpecificWorkerContextWrapper wrappedWorkerContext = myWrappedWorkerContext; diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java index ac17c300554..2528e5577ad 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java @@ -143,7 +143,6 @@ public List validate( v.setNoBindingMsgSuppressed(myNoBindingMsgSuppressed); v.setAllowXsiLocation(true); - List messages = new ArrayList<>(); List profiles = new ArrayList<>(); From 5faa571822a75ccf5b4c9e9acbbb9fd68661fb42 Mon Sep 17 00:00:00 2001 From: dotasek Date: Thu, 3 Oct 2024 17:54:31 -0400 Subject: [PATCH 4/4] Don't expose unknownCodeSystemsCausesErrors for now. Use a constant. --- .../validation/validator/FhirInstanceValidator.java | 11 +---------- .../hapi/validation/validator/ValidatorWrapper.java | 10 +++------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirInstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirInstanceValidator.java index 09dd738a9b7..33e8844f951 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirInstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirInstanceValidator.java @@ -35,7 +35,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta private boolean noBindingMsgSuppressed = false; private volatile VersionSpecificWorkerContextWrapper myWrappedWorkerContext; private boolean errorForUnknownProfiles = true; - private boolean myUnknownSystemsCauseErrors = true; + private boolean assumeValidRestReferences; private List myExtensionDomains = Collections.emptyList(); private IValidatorResourceFetcher validatorResourceFetcher; @@ -133,14 +133,6 @@ public void setBestPracticeWarningLevel(BestPracticeWarningLevel theBestPractice myBestPracticeWarningLevel = theBestPracticeWarningLevel; } - public void setUnknownSystemsCauseErrors(boolean theUnknownSystemsCauseErrors) { - myUnknownSystemsCauseErrors = theUnknownSystemsCauseErrors; - } - - public boolean isUnknownSystemsCauseErrors() { - return myUnknownSystemsCauseErrors; - } - /** * Returns the {@link IValidationSupport validation support} in use by this validator. Default is an instance of * DefaultProfileValidationSupport if the no-arguments constructor for this object was used. @@ -238,7 +230,6 @@ protected List validate(IValidationContext theValidationCt .setAnyExtensionsAllowed(isAnyExtensionsAllowed()) .setBestPracticeWarningLevel(getBestPracticeWarningLevel()) .setErrorForUnknownProfiles(isErrorForUnknownProfiles()) - .setUnknownSystemsCauseErrors(isUnknownSystemsCauseErrors()) .setExtensionDomains(getExtensionDomains()) .setValidationPolicyAdvisor(validatorPolicyAdvisor) .setNoTerminologyChecks(isNoTerminologyChecks()) diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java index 2528e5577ad..ac383cc3ca7 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java @@ -47,7 +47,7 @@ class ValidatorWrapper { private boolean myAssumeValidRestReferences; private boolean myNoExtensibleWarnings; private boolean myNoBindingMsgSuppressed; - private boolean myUnknownSystemsCauseErrors; + private Collection myExtensionDomains; private IValidatorResourceFetcher myValidatorResourceFetcher; private IValidationPolicyAdvisor myValidationPolicyAdvisor; @@ -83,11 +83,6 @@ public ValidatorWrapper setErrorForUnknownProfiles(boolean theErrorForUnknownPro return this; } - public ValidatorWrapper setUnknownSystemsCauseErrors(boolean theUnknownSystemsCauseErrors) { - myUnknownSystemsCauseErrors = theUnknownSystemsCauseErrors; - return this; - } - public ValidatorWrapper setNoTerminologyChecks(boolean theNoTerminologyChecks) { myNoTerminologyChecks = theNoTerminologyChecks; return this; @@ -135,7 +130,8 @@ public List validate( v.setResourceIdRule(IdStatus.OPTIONAL); v.setNoTerminologyChecks(myNoTerminologyChecks); v.setErrorForUnknownProfiles(myErrorForUnknownProfiles); - v.setUnknownCodeSystemsCauseErrors(myUnknownSystemsCauseErrors); + /* setUnknownCodeSystemsCauseErrors interacts with UnknownCodeSystemWarningValidationSupport. Until this interaction is resolved, the value here should remain fixed. */ + v.setUnknownCodeSystemsCauseErrors(true); v.getExtensionDomains().addAll(myExtensionDomains); v.setFetcher(myValidatorResourceFetcher); v.setPolicyAdvisor(myValidationPolicyAdvisor);