Add ability to turn caching off (for debugging) + add parameter for suppress extensible binding warnins

This commit is contained in:
Grahame Grieve 2020-04-22 16:42:44 +10:00
parent 175d5fa0b7
commit bcde2d2f46
4 changed files with 41 additions and 0 deletions

View File

@ -243,6 +243,7 @@ public class ValidationEngine implements IValidatorResourceFetcher {
private Set<String> loadedIgs = new HashSet<>();
private IValidatorResourceFetcher fetcher;
private boolean assumeValidRestReferences;
private boolean noExtensibleBindingMessages;
private Locale locale;
private class AsteriskFilter implements FilenameFilter {
@ -1272,6 +1273,7 @@ public class ValidationEngine implements IValidatorResourceFetcher {
validator.setNoInvariantChecks(isNoInvariantChecks());
validator.setValidationLanguage(language);
validator.setAssumeValidRestReferences(assumeValidRestReferences);
validator.setNoExtensibleWarnings(noExtensibleBindingMessages);
validator.getContext().setLocale(locale);
validator.setFetcher(this);
return validator;
@ -1701,6 +1703,14 @@ public class ValidationEngine implements IValidatorResourceFetcher {
this.assumeValidRestReferences = assumeValidRestReferences;
}
public boolean isNoExtensibleBindingMessages() {
return noExtensibleBindingMessages;
}
public void setNoExtensibleBindingMessages(boolean noExtensibleBindingMessages) {
this.noExtensibleBindingMessages = noExtensibleBindingMessages;
}
public byte[] transformVersion(String source, String targetVer, FhirFormat format, Boolean canDoNative) throws FHIRException, IOException, Exception {
Content cnt = loadContent(source, "validate");
org.hl7.fhir.r5.elementmodel.Element src = Manager.parse(context, new ByteArrayInputStream(cnt.focus), cnt.cntType);

View File

@ -32,6 +32,8 @@ public class CliContext {
private String snomedCT = SnomedVersion.INTL.getCode();
private String targetVer = null;
private boolean doDebug = false;
private boolean noInternalCaching = false; // internal, for when debugging terminology validation
private boolean noExtensibleBindingMessages = false;
private boolean assumeValidRestReferences = false;
public String getMap() {
@ -286,4 +288,24 @@ public class CliContext {
this.assumeValidRestReferences = assumeValidRestReferences;
return this;
}
public boolean isNoInternalCaching() {
return noInternalCaching;
}
public CliContext setNoInternalCaching(boolean noInternalCaching) {
this.noInternalCaching = noInternalCaching;
return this;
}
public boolean isNoExtensibleBindingMessages() {
return noExtensibleBindingMessages;
}
public CliContext setNoExtensibleBindingMessages(boolean noExtensibleBindingMessages) {
this.noExtensibleBindingMessages = noExtensibleBindingMessages;
return this;
}
}

View File

@ -45,6 +45,8 @@ public class Params {
public static final String DESTINATION = "-dest";
public static final String LEFT = "-left";
public static final String RIGHT = "-right";
public static final String NO_INTERNAL_CACHING = "-no-internal-caching";
public static final String NO_EXTENSIBLE_BINDING_WARNINGS = "-no-extensible-binding-warnings";
/**
* Checks the list of passed in params to see if it contains the passed in param.
@ -126,6 +128,10 @@ public class Params {
}
} else if (args[i].equals(STRICT_EXTENSIONS)) {
cliContext.setAnyExtensionsAllowed(false);
} else if (args[i].equals(NO_INTERNAL_CACHING)) {
cliContext.setNoInternalCaching(true);
} else if (args[i].equals(NO_EXTENSIBLE_BINDING_WARNINGS)) {
cliContext.setNoExtensibleBindingMessages(true);
} else if (args[i].equals(HINT_ABOUT_NON_MUST_SUPPORT)) {
cliContext.setHintAboutNonMustSupport(true);
} else if (args[i].equals(TO_VERSION)) {

View File

@ -1,5 +1,6 @@
package org.hl7.fhir.validation.cli;
import org.hl7.fhir.r5.context.TerminologyCache;
import org.hl7.fhir.r5.elementmodel.Manager;
import org.hl7.fhir.r5.formats.IParser;
import org.hl7.fhir.r5.formats.JsonParser;
@ -155,6 +156,8 @@ public class ValidationUtils {
validator.setLocale(cliContext.getLocale());
validator.setSnomedExtension(cliContext.getSnomedCT());
validator.setAssumeValidRestReferences(cliContext.isAssumeValidRestReferences());
validator.setNoExtensibleBindingMessages(cliContext.isNoExtensibleBindingMessages());
TerminologyCache.setNoCaching(cliContext.isNoInternalCaching());
return validator;
}