Merge pull request #798 from hapifhir/gg-202204-validator-extensions
enable -extension parameter for validator
This commit is contained in:
commit
220f32a94b
|
@ -5497,7 +5497,6 @@ public class FHIRPathEngine {
|
|||
return list.size() != 1 ? true : Utilities.existsInList(list.get(0).getCode(), "Element", "BackboneElement", "Resource", "DomainResource");
|
||||
}
|
||||
|
||||
|
||||
private boolean hasType(ElementDefinition ed, String s) {
|
||||
for (TypeRefComponent t : ed.getType()) {
|
||||
if (s.equalsIgnoreCase(t.getCode())) {
|
||||
|
|
|
@ -95,6 +95,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
|||
private boolean buildLoaded = false;
|
||||
private Map<String, String> ciList = new HashMap<String, String>();
|
||||
private JsonArray buildInfo;
|
||||
private boolean suppressErrors;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -354,7 +355,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
|||
System.out.print(" Installing: ");
|
||||
}
|
||||
|
||||
if (npm.name() == null || id == null || !id.equalsIgnoreCase(npm.name())) {
|
||||
if (!suppressErrors && npm.name() == null || id == null || !id.equalsIgnoreCase(npm.name())) {
|
||||
if (!id.equals("hl7.fhir.r5.core") && !id.equals("hl7.fhir.us.immds")) {// temporary work around
|
||||
throw new IOException("Attempt to import a mis-identified package. Expected " + id + ", got " + npm.name());
|
||||
}
|
||||
|
@ -939,4 +940,13 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isSuppressErrors() {
|
||||
return suppressErrors;
|
||||
}
|
||||
|
||||
public void setSuppressErrors(boolean suppressErrors) {
|
||||
this.suppressErrors = suppressErrors;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -159,6 +159,8 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
|||
@Getter @Setter private boolean showMessagesFromReferences;
|
||||
@Getter @Setter private Locale locale;
|
||||
@Getter @Setter private List<ImplementationGuide> igs = new ArrayList<>();
|
||||
@Getter @Setter private List<String> extensionDomains = new ArrayList<>();
|
||||
|
||||
@Getter @Setter private boolean showTimes;
|
||||
@Getter @Setter private List<BundleValidationRule> bundleValidationRules = new ArrayList<>();
|
||||
@Getter @Setter private QuestionnaireMode questionnaireMode;
|
||||
|
@ -596,6 +598,8 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
|||
InstanceValidator validator = new InstanceValidator(context, null, null);
|
||||
validator.setHintAboutNonMustSupport(hintAboutNonMustSupport);
|
||||
validator.setAnyExtensionsAllowed(anyExtensionsAllowed);
|
||||
validator.getExtensionDomains().clear();
|
||||
validator.getExtensionDomains().addAll(extensionDomains);
|
||||
validator.setNoInvariantChecks(isNoInvariantChecks());
|
||||
validator.setWantInvariantInMessage(isWantInvariantInMessage());
|
||||
validator.setValidationLanguage(language);
|
||||
|
|
|
@ -22,8 +22,6 @@ public class CliContext {
|
|||
|
||||
@JsonProperty("doNative")
|
||||
private boolean doNative = false;
|
||||
@JsonProperty("anyExtensionsAllowed")
|
||||
private boolean anyExtensionsAllowed = true;
|
||||
@JsonProperty("hintAboutNonMustSupport")
|
||||
private boolean hintAboutNonMustSupport = false;
|
||||
@JsonProperty("recursive")
|
||||
|
@ -72,6 +70,8 @@ public class CliContext {
|
|||
@JsonProperty("targetVer")
|
||||
private String targetVer = null;
|
||||
|
||||
@JsonProperty("extensions")
|
||||
private List<String> extensions = new ArrayList<String>();
|
||||
@JsonProperty("igs")
|
||||
private List<String> igs = new ArrayList<String>();
|
||||
@JsonProperty("questionnaire")
|
||||
|
@ -191,15 +191,9 @@ public class CliContext {
|
|||
return this;
|
||||
}
|
||||
|
||||
@JsonProperty("anyExtensionsAllowed")
|
||||
public boolean isAnyExtensionsAllowed() {
|
||||
return anyExtensionsAllowed;
|
||||
}
|
||||
|
||||
@JsonProperty("anyExtensionsAllowed")
|
||||
public CliContext setAnyExtensionsAllowed(boolean anyExtensionsAllowed) {
|
||||
this.anyExtensionsAllowed = anyExtensionsAllowed;
|
||||
return this;
|
||||
@JsonProperty("extensions")
|
||||
public List<String> getExtensions() {
|
||||
return extensions;
|
||||
}
|
||||
|
||||
@JsonProperty("hintAboutNonMustSupport")
|
||||
|
@ -576,7 +570,6 @@ public class CliContext {
|
|||
if (o == null || getClass() != o.getClass()) return false;
|
||||
CliContext that = (CliContext) o;
|
||||
return doNative == that.doNative &&
|
||||
anyExtensionsAllowed == that.anyExtensionsAllowed &&
|
||||
hintAboutNonMustSupport == that.hintAboutNonMustSupport &&
|
||||
recursive == that.recursive &&
|
||||
doDebug == that.doDebug &&
|
||||
|
@ -587,6 +580,7 @@ public class CliContext {
|
|||
noUnicodeBiDiControlChars == that.noUnicodeBiDiControlChars &&
|
||||
noInvariants == that.noInvariants &&
|
||||
wantInvariantsInMessages == that.wantInvariantsInMessages &&
|
||||
Objects.equals(extensions, that.extensions) &&
|
||||
Objects.equals(map, that.map) &&
|
||||
Objects.equals(output, that.output) &&
|
||||
Objects.equals(htmlOutput, that.htmlOutput) &&
|
||||
|
@ -615,7 +609,7 @@ public class CliContext {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(doNative, anyExtensionsAllowed, hintAboutNonMustSupport, recursive, doDebug, assumeValidRestReferences, canDoNative, noInternalCaching,
|
||||
return Objects.hash(doNative, extensions, hintAboutNonMustSupport, recursive, doDebug, assumeValidRestReferences, canDoNative, noInternalCaching,
|
||||
noExtensibleBindingMessages, noInvariants, wantInvariantsInMessages, map, output, htmlOutput, txServer, sv, txLog, txCache, mapLog, lang, fhirpath, snomedCT,
|
||||
targetVer, igs, questionnaireMode, level, profiles, sources, mode, locale, locations, crumbTrails, showTimes, allowExampleUrls, outputStyle, noUnicodeBiDiControlChars);
|
||||
}
|
||||
|
@ -624,7 +618,7 @@ public class CliContext {
|
|||
public String toString() {
|
||||
return "CliContext{" +
|
||||
"doNative=" + doNative +
|
||||
", anyExtensionsAllowed=" + anyExtensionsAllowed +
|
||||
", extensions=" + extensions +
|
||||
", hintAboutNonMustSupport=" + hintAboutNonMustSupport +
|
||||
", recursive=" + recursive +
|
||||
", doDebug=" + doDebug +
|
||||
|
|
|
@ -340,7 +340,13 @@ public class ValidationService {
|
|||
validator.setLevel(cliContext.getLevel());
|
||||
validator.setDoNative(cliContext.isDoNative());
|
||||
validator.setHintAboutNonMustSupport(cliContext.isHintAboutNonMustSupport());
|
||||
validator.setAnyExtensionsAllowed(cliContext.isAnyExtensionsAllowed());
|
||||
for (String s : cliContext.getExtensions()) {
|
||||
if ("*".equals(s)) {
|
||||
validator.setAnyExtensionsAllowed(true);
|
||||
} else {
|
||||
validator.getExtensionDomains().add(s);
|
||||
}
|
||||
}
|
||||
validator.setLanguage(cliContext.getLang());
|
||||
validator.setLocale(cliContext.getLocale());
|
||||
validator.setSnomedExtension(cliContext.getSnomedCTCode());
|
||||
|
|
|
@ -26,7 +26,7 @@ public class Params {
|
|||
public static final String RECURSE = "-recurse";
|
||||
public static final String SHOW_MESSAGES_FROM_REFERENCES = "-showReferenceMessages";
|
||||
public static final String LOCALE = "-locale";
|
||||
public static final String STRICT_EXTENSIONS = "-strictExtensions";
|
||||
public static final String EXTENSIONS = "-extensions";
|
||||
public static final String HINT_ABOUT_NON_MUST_SUPPORT = "-hintAboutNonMustSupport";
|
||||
public static final String TO_VERSION = "-to-version";
|
||||
public static final String DO_NATIVE = "-do-native";
|
||||
|
@ -169,8 +169,8 @@ public class Params {
|
|||
} else {
|
||||
cliContext.setLocale(new Locale(args[++i]));
|
||||
}
|
||||
} else if (args[i].equals(STRICT_EXTENSIONS)) {
|
||||
cliContext.setAnyExtensionsAllowed(false);
|
||||
} else if (args[i].equals(EXTENSIONS)) {
|
||||
cliContext.getExtensions().add(args[++i]);
|
||||
} else if (args[i].equals(NO_INTERNAL_CACHING)) {
|
||||
cliContext.setNoInternalCaching(true);
|
||||
} else if (args[i].equals(NO_EXTENSIBLE_BINDING_WARNINGS)) {
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
-------------------------------------------------------------------------------------
|
||||
{"hierarchical" : false, "valueSet" :{
|
||||
"resourceType" : "ValueSet",
|
||||
"compose" : {
|
||||
"inactive" : true,
|
||||
"include" : [{
|
||||
"system" : "urn:iso:std:iso:4217"
|
||||
}]
|
||||
}
|
||||
}}####
|
||||
e: {
|
||||
"error" : "java.lang.NullPointerException"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
||||
{"hierarchical" : false, "url": "http://hl7.org/fhir/ValueSet/currencies", "version": "4.0.1"}####
|
||||
e: {
|
||||
"error" : "java.lang.NullPointerException"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
|
@ -0,0 +1,11 @@
|
|||
-------------------------------------------------------------------------------------
|
||||
{"code" : {
|
||||
"system" : "urn:ietf:bcp:47",
|
||||
"code" : "fr-CA"
|
||||
}, "valueSet" :null, "lang":"en-US", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"true"}####
|
||||
v: {
|
||||
"severity" : "error",
|
||||
"error" : "Attempt to use Terminology server when no Terminology server is available",
|
||||
"class" : "SERVER_ERROR"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
|
@ -0,0 +1,90 @@
|
|||
-------------------------------------------------------------------------------------
|
||||
{"hierarchical" : false, "valueSet" :{
|
||||
"resourceType" : "ValueSet",
|
||||
"compose" : {
|
||||
"inactive" : true,
|
||||
"include" : [{
|
||||
"system" : "http://loinc.org",
|
||||
"concept" : [{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
|
||||
"valueString" : "A."
|
||||
}],
|
||||
"code" : "LA20752-4",
|
||||
"display" : "Within 24 hours"
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
|
||||
"valueString" : "B."
|
||||
}],
|
||||
"code" : "LA20753-2",
|
||||
"display" : "After 24 hours but before 3 days"
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
|
||||
"valueString" : "C."
|
||||
}],
|
||||
"code" : "LA20754-0",
|
||||
"display" : "Three days or later"
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
|
||||
"valueString" : "D."
|
||||
}],
|
||||
"code" : "LA4489-6",
|
||||
"display" : "Unknown"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}}####
|
||||
e: {
|
||||
"error" : "java.lang.NullPointerException"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
||||
{"hierarchical" : false, "valueSet" :{
|
||||
"resourceType" : "ValueSet",
|
||||
"compose" : {
|
||||
"include" : [{
|
||||
"system" : "http://loinc.org",
|
||||
"concept" : [{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
|
||||
"valueString" : "A."
|
||||
}],
|
||||
"code" : "LA20752-4",
|
||||
"display" : "Within 24 hours"
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
|
||||
"valueString" : "B."
|
||||
}],
|
||||
"code" : "LA20753-2",
|
||||
"display" : "After 24 hours but before 3 days"
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
|
||||
"valueString" : "C."
|
||||
}],
|
||||
"code" : "LA20754-0",
|
||||
"display" : "Three days or later"
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
|
||||
"valueString" : "D."
|
||||
}],
|
||||
"code" : "LA4489-6",
|
||||
"display" : "Unknown"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}}####
|
||||
e: {
|
||||
"error" : "java.lang.NullPointerException"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
|
@ -0,0 +1,19 @@
|
|||
-------------------------------------------------------------------------------------
|
||||
{"hierarchical" : false, "valueSet" :{
|
||||
"resourceType" : "ValueSet",
|
||||
"compose" : {
|
||||
"inactive" : true,
|
||||
"include" : [{
|
||||
"system" : "urn:ietf:bcp:13"
|
||||
}]
|
||||
}
|
||||
}}####
|
||||
e: {
|
||||
"error" : "java.lang.NullPointerException"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
||||
{"hierarchical" : false, "url": "http://hl7.org/fhir/ValueSet/mimetypes", "version": "4.0.1"}####
|
||||
e: {
|
||||
"error" : "java.lang.NullPointerException"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
|
@ -0,0 +1,103 @@
|
|||
-------------------------------------------------------------------------------------
|
||||
{"hierarchical" : false, "valueSet" :{
|
||||
"resourceType" : "ValueSet",
|
||||
"compose" : {
|
||||
"inactive" : true,
|
||||
"include" : [{
|
||||
"system" : "http://unitsofmeasure.org",
|
||||
"concept" : [{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
|
||||
"valueString" : "second"
|
||||
}],
|
||||
"code" : "s",
|
||||
"display" : "second",
|
||||
"designation" : [{
|
||||
"language" : "zh",
|
||||
"value" : "秒"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
|
||||
"valueString" : "minute"
|
||||
}],
|
||||
"code" : "min",
|
||||
"display" : "minute",
|
||||
"designation" : [{
|
||||
"language" : "zh",
|
||||
"value" : "分钟"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
|
||||
"valueString" : "hour"
|
||||
}],
|
||||
"code" : "h",
|
||||
"display" : "hour",
|
||||
"designation" : [{
|
||||
"language" : "zh",
|
||||
"value" : "小时"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
|
||||
"valueString" : "day"
|
||||
}],
|
||||
"code" : "d",
|
||||
"display" : "day",
|
||||
"designation" : [{
|
||||
"language" : "zh",
|
||||
"value" : "天"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
|
||||
"valueString" : "week"
|
||||
}],
|
||||
"code" : "wk",
|
||||
"display" : "week",
|
||||
"designation" : [{
|
||||
"language" : "zh",
|
||||
"value" : "星期"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
|
||||
"valueString" : "month"
|
||||
}],
|
||||
"code" : "mo",
|
||||
"display" : "month",
|
||||
"designation" : [{
|
||||
"language" : "zh",
|
||||
"value" : "月"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
|
||||
"valueString" : "year"
|
||||
}],
|
||||
"code" : "a",
|
||||
"display" : "year",
|
||||
"designation" : [{
|
||||
"language" : "zh",
|
||||
"value" : "年"
|
||||
}]
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}}####
|
||||
e: {
|
||||
"error" : "java.lang.NullPointerException"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
||||
{"hierarchical" : false, "url": "http://hl7.org/fhir/ValueSet/units-of-time", "version": "4.0.1"}####
|
||||
e: {
|
||||
"error" : "java.lang.NullPointerException"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
Loading…
Reference in New Issue