mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-02-13 16:24:44 +00:00
validate example URLs in value sets correctly
This commit is contained in:
parent
417bae01b1
commit
05a367b088
@ -668,6 +668,8 @@ public class I18nConstants {
|
|||||||
public static final String MEASURE_SHAREABLE_MISSING_HL7 = "MEASURE_SHAREABLE_MISSING_HL7";
|
public static final String MEASURE_SHAREABLE_MISSING_HL7 = "MEASURE_SHAREABLE_MISSING_HL7";
|
||||||
public static final String MEASURE_SHAREABLE_EXTRA_MISSING_HL7 = "MEASURE_SHAREABLE_EXTRA_MISSING_HL7";
|
public static final String MEASURE_SHAREABLE_EXTRA_MISSING_HL7 = "MEASURE_SHAREABLE_EXTRA_MISSING_HL7";
|
||||||
public static final String MEASURE_SHAREABLE_EXTRA_MISSING = "MEASURE_SHAREABLE_EXTRA_MISSING";
|
public static final String MEASURE_SHAREABLE_EXTRA_MISSING = "MEASURE_SHAREABLE_EXTRA_MISSING";
|
||||||
|
public static final String VALUESET_EXAMPLE_SYSTEM_ERROR = "VALUESET_EXAMPLE_SYSTEM_ERROR";
|
||||||
|
public static final String VALUESET_EXAMPLE_SYSTEM_HINT = "VALUESET_EXAMPLE_SYSTEM_HINT";
|
||||||
public static final String VALUESET_UNC_SYSTEM_WARNING = "VALUESET_UNC_SYSTEM_WARNING";
|
public static final String VALUESET_UNC_SYSTEM_WARNING = "VALUESET_UNC_SYSTEM_WARNING";
|
||||||
public static final String VALUESET_UNC_SYSTEM_WARNING_VER = "VALUESET_UNC_SYSTEM_WARNING_VER";
|
public static final String VALUESET_UNC_SYSTEM_WARNING_VER = "VALUESET_UNC_SYSTEM_WARNING_VER";
|
||||||
public static final String VALUESET_IMPORT_UNION_INTERSECTION = "VALUESET_IMPORT_UNION_INTERSECTION";
|
public static final String VALUESET_IMPORT_UNION_INTERSECTION = "VALUESET_IMPORT_UNION_INTERSECTION";
|
||||||
|
@ -43,13 +43,13 @@ public class ValueSetValidator extends BaseValidator {
|
|||||||
|
|
||||||
private InstanceValidator parent;
|
private InstanceValidator parent;
|
||||||
|
|
||||||
public ValueSetValidator(IWorkerContext context, TimeTracker timeTracker, InstanceValidator parent, XVerExtensionManager xverManager, Coding jurisdiction) {
|
public ValueSetValidator(IWorkerContext context, TimeTracker timeTracker, InstanceValidator parent, XVerExtensionManager xverManager, Coding jurisdiction, boolean allowExamples) {
|
||||||
super(context, xverManager);
|
super(context, xverManager);
|
||||||
source = Source.InstanceValidator;
|
source = Source.InstanceValidator;
|
||||||
this.timeTracker = timeTracker;
|
this.timeTracker = timeTracker;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.jurisdiction = jurisdiction;
|
this.jurisdiction = jurisdiction;
|
||||||
|
this.allowExamples = allowExamples;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean validateValueSet(List<ValidationMessage> errors, Element vs, NodeStack stack) {
|
public boolean validateValueSet(List<ValidationMessage> errors, Element vs, NodeStack stack) {
|
||||||
@ -190,7 +190,15 @@ public class ValueSetValidator extends BaseValidator {
|
|||||||
if (version == null) {
|
if (version == null) {
|
||||||
ValidationResult vv = context.validateCode(ValidationOptions.defaults(), new Coding(system, code, null), null);
|
ValidationResult vv = context.validateCode(ValidationOptions.defaults(), new Coding(system, code, null), null);
|
||||||
if (vv.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED) {
|
if (vv.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED) {
|
||||||
|
if (isExampleUrl(system)) {
|
||||||
|
if (isAllowExamples()) {
|
||||||
|
hint(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, stackInc.getLiteralPath(), false, I18nConstants.VALUESET_EXAMPLE_SYSTEM_HINT, system);
|
||||||
|
} else {
|
||||||
|
rule(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, stackInc.getLiteralPath(), false, I18nConstants.VALUESET_EXAMPLE_SYSTEM_ERROR, system);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
warning(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, stackInc.getLiteralPath(), false, I18nConstants.VALUESET_UNC_SYSTEM_WARNING, system, vv.getMessage());
|
warning(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, stackInc.getLiteralPath(), false, I18nConstants.VALUESET_UNC_SYSTEM_WARNING, system, vv.getMessage());
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
boolean ok = vv.isOk();
|
boolean ok = vv.isOk();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user