fix misleading validation message + add -ips parameter for validator

This commit is contained in:
Grahame Grieve 2021-10-08 08:10:40 +11:00
parent a8ba0ed4e5
commit 9ae20d56a4
3 changed files with 46 additions and 3 deletions

View File

@ -11,6 +11,7 @@ public class ValidationOptions {
private boolean useClient = true;
private boolean guessSystem = false;
private ValueSetMode valueSetMode = ValueSetMode.ALL_CHECKS;
private boolean vsAsUrl;
public ValidationOptions() {
super();
@ -43,6 +44,7 @@ public class ValidationOptions {
n.useServer = useServer;
n.useClient = useClient;
n.guessSystem = guessSystem;
n.vsAsUrl = vsAsUrl;
return n;
}
@ -96,5 +98,14 @@ public class ValidationOptions {
return valueSetMode;
}
public ValidationOptions setVsAsUrl() {
vsAsUrl = true;
return this;
}
public boolean getVsAsUrl() {
return vsAsUrl;
}
}

View File

@ -229,7 +229,6 @@ Validation_VAL_Profile_SliceOrder = As specified by profile {0}, Element ''{1}''
Validation_VAL_Profile_Unknown = Profile reference ''{0}'' has not been checked because it is unknown
VALIDATION_VAL_PROFILE_UNKNOWN_NOT_POLICY = Profile reference ''{0}'' has not been checked because it is unknown, and the validator is set to not fetch unknown profiles
VALIDATION_VAL_PROFILE_UNKNOWN_ERROR = Profile reference ''{0}'' has not been checked because it is unknown, and fetching it resulted in the error {1}
Validation_VAL_Profile_WrongType = Specified profile type was ''{0}'', but found type ''{1}''
Validation_VAL_Unknown_Profile = Unknown profile {0}
XHTML_XHTML_Attribute_Illegal = Illegal attribute name in the XHTML (''{0}'' on ''{1}'')
XHTML_XHTML_Element_Illegal = Illegal element name in the XHTML (''{0}'')
@ -503,7 +502,7 @@ TYPE_SPECIFIC_CHECKS_DT_ATT_TOO_LONG = Attachment size is {0} bytes which exceed
TYPE_SPECIFIC_CHECKS_DT_ATT_NO_CONTENT = Attachments have data and/or url, or else SHOULD have either contentType and/or language
TYPE_SPECIFIC_CHECKS_DT_BASE64_TOO_LONG = Base64 size is {0} bytes which exceeds the stated limit of {1} bytes
TYPE_SPECIFIC_CHECKS_DT_DECIMAL_CHARS = Found {0} decimal places which exceeds the stated limit of {1} digits
Validation_VAL_Profile_WrongType = Specified profile type was ''{0}'', but found type ''{1}''
Validation_VAL_Profile_WrongType = Specified profile type was ''{0}'' in profile ''{2}'', but found type ''{1}''
Validation_VAL_Profile_WrongType2 = Type mismatch processing profile {0} at path {1}: The element type is {4}, but the profile {3} is for a different type {2}
VALIDATION_VAL_ILLEGAL_TYPE_CONSTRAINT = Illegal constraint in profile {0} at path {1} - cannot constrain to type {2} from base types {3}
EXTENSION_EXT_CONTEXT_WRONG_XVER = The extension {0} from FHIR version {3} is not allowed to be used at this point (allowed = {1}; this element is [{2}; this is a warning since contexts may be renamed between FHIR versions)

View File

@ -71,6 +71,8 @@ import org.hl7.fhir.validation.cli.utils.*;
import java.io.File;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.util.ArrayList;
import java.util.List;
/**
* A executable class that will validate one or more FHIR resources against
@ -101,6 +103,8 @@ public class ValidatorCli {
TimeTracker tt = new TimeTracker();
TimeTracker.Session tts = tt.start("Loading");
args = preProcessArgs(args);
Display.displayVersion();
Display.displaySystemInfo();
@ -160,6 +164,35 @@ public class ValidatorCli {
}
}
private static String[] preProcessArgs(String[] args) {
// ips$branch --> -version 4.0 -ig hl7.fhir.uv.ips#current$connectathon-2 -profile http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips
List<String> res = new ArrayList<>();
for (String a : args) {
if (a.equals("-ips")) {
res.add("-version");
res.add("4.0");
res.add("-ig");
res.add("hl7.fhir.uv.ips#current$connectathon-2");
res.add("-profile");
res.add("http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips");
} else if (a.startsWith("-ips$")) {
res.add("-version");
res.add("4.0");
res.add("-ig");
res.add("hl7.fhir.uv.ips#current$"+a.substring(5));
res.add("-profile");
res.add("http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips");
} else {
res.add(a);
}
}
String[] r = new String[res.size()];
for (int i = 0; i < res.size(); i++) {
r[i] = res.get(i);
}
return r;
}
private static boolean destinationDirectoryValid(String dest) {
if (dest == null) {
System.out.println("no -dest parameter provided");