2727import org .hl7 .fhir .common .hapi .validation .validator .WorkerContextValidationSupportAdapter ;
2828import org .hl7 .fhir .exceptions .FHIRException ;
2929import org .hl7 .fhir .instance .model .api .IBaseResource ;
30+ import org .hl7 .fhir .r4 .model .Bundle ;
3031import org .hl7 .fhir .r4 .model .Resource ;
3132import org .hl7 .fhir .r5 .model .CanonicalResource ;
3233import org .hl7 .fhir .r5 .model .CanonicalType ;
@@ -196,10 +197,13 @@ public ValidationResult validate(Resource resource)
196197 {
197198 ValidationResult result = validator .validateWithResult (resource );
198199
199- // TODO: remove after HAPI validator is fixed: https://github.com/hapifhir/org.hl7.fhir.core/issues/193
200+ // TODO remove after HAPI validator is fixed: https://github.com/hapifhir/org.hl7.fhir.core/issues/193
200201 adaptDefaultSliceValidationErrorToWarning (result );
201202 adaptQuestionnaireTextNotSameValidationErrorToWarning (result );
202203
204+ // TODO remove if MII plugins with error no longer in circulation
205+ adaptMiiPluginsBundleFullUrlUuidNullErrorToWarning (resource , result );
206+
203207 return new ValidationResult (context ,
204208 result .getMessages ().stream ().filter (m -> !(ResultSeverityEnum .WARNING .equals (m .getSeverity ())
205209 && m .getMessage ().startsWith (MISSING_NARRATIVE_MESSAGE_START ))).toList ());
@@ -220,4 +224,18 @@ private void adaptQuestionnaireTextNotSameValidationErrorToWarning(ValidationRes
220224 .startsWith ("If text exists, it must match the questionnaire definition for linkId" ))
221225 .forEach (m -> m .setSeverity (ResultSeverityEnum .WARNING ));
222226 }
227+
228+ private void adaptMiiPluginsBundleFullUrlUuidNullErrorToWarning (Resource resource , ValidationResult result )
229+ {
230+ if (resource instanceof Bundle b && b .hasIdentifier ()
231+ && "http://medizininformatik-initiative.de/fhir/CodeSystem/cryptography"
232+ .equals (b .getIdentifier ().getSystem ())
233+ && "public-key" .equals (b .getIdentifier ().getValue ()))
234+ {
235+ result .getMessages ().stream ()
236+ .filter (m -> ResultSeverityEnum .ERROR .equals (m .getSeverity ())
237+ && "UUIDs must be valid and lowercase (null)" .equals (m .getMessage ()))
238+ .forEach (m -> m .setSeverity (ResultSeverityEnum .WARNING ));
239+ }
240+ }
223241}
0 commit comments