Merge remote-tracking branch 'origin/master'

This commit is contained in:
Grahame Grieve 2023-06-28 15:57:27 +10:00
commit 7f7a6b3037
2 changed files with 25 additions and 7 deletions

View File

@ -1,9 +1,6 @@
package org.hl7.fhir.utilities; package org.hl7.fhir.utilities;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
@ -41,6 +38,9 @@ import org.hl7.fhir.exceptions.FHIRException;
public class VersionUtilities { public class VersionUtilities {
public static final String[] SUPPORTED_MAJOR_VERSIONS = {"1.0", "1.4", "3.0", "4.0", "5.0", "6.0"};
public static final String[] SUPPORTED_VERSIONS = {"1.0.2", "1.4.0", "3.0.2", "4.0.1", "4.1.0", "4.3.0", "5.0.0", "6.0.0"};
public static class VersionURLInfo { public static class VersionURLInfo {
private String version; private String version;
private String url; private String url;
@ -138,11 +138,23 @@ public class VersionUtilities {
if (version.contains("-")) { if (version.contains("-")) {
version = version.substring(0, version.indexOf("-")); version = version.substring(0, version.indexOf("-"));
} }
return Utilities.existsInList(version, "1.0.2", "1.4.0", "3.0.2", "4.0.1", "4.1.0", "4.3.0", "5.0.0", "6.0.0"); return Utilities.existsInList(version, SUPPORTED_VERSIONS);
} }
public static String listSupportedVersions() { public static String listSupportedVersions() {
return "1.0.2, 1.4.0, 3.0.2, 4.0.1, 4.1.0, 4.3.0, 5.0, 6.0"; return listVersions(SUPPORTED_VERSIONS);
}
public static String listSupportedMajorVersions() {
return listVersions(SUPPORTED_MAJOR_VERSIONS);
}
private static String listVersions(String[] versions) {
StringJoiner stringJoiner = new StringJoiner(", ");
for (String supportedVersion : versions) {
stringJoiner.add(supportedVersion);
}
return stringJoiner.toString();
} }
public static boolean isR6Ver(String ver) { public static boolean isR6Ver(String ver) {

View File

@ -1,9 +1,11 @@
package org.hl7.fhir.validation.cli.tasks; package org.hl7.fhir.validation.cli.tasks;
import ca.uhn.fhir.context.FhirVersionEnum;
import org.hl7.fhir.r5.model.Constants; import org.hl7.fhir.r5.model.Constants;
import org.hl7.fhir.r5.model.ImplementationGuide; import org.hl7.fhir.r5.model.ImplementationGuide;
import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.utilities.TimeTracker; import org.hl7.fhir.utilities.TimeTracker;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.validation.ValidationEngine; import org.hl7.fhir.validation.ValidationEngine;
import org.hl7.fhir.validation.cli.model.CliContext; import org.hl7.fhir.validation.cli.model.CliContext;
import org.hl7.fhir.validation.cli.services.ValidationService; import org.hl7.fhir.validation.cli.services.ValidationService;
@ -15,9 +17,13 @@ import java.io.PrintStream;
public class ValidateTask extends ValidationEngineTask { public class ValidateTask extends ValidationEngineTask {
final static String[][] PLACEHOLDERS = { final static String[][] PLACEHOLDERS = {
{ "XML_AND_JSON_FHIR_VERSIONS", "1.0, 1.4, 3.0, 4.0, " + Constants.VERSION_MM }, { "XML_AND_JSON_FHIR_VERSIONS", "1.0, 1.4, 3.0, 4.0, " + Constants.VERSION_MM + ", 6.0" },
{ "TURTLE_FHIR_VERSIONS", "3.0, 4.0, " + Constants.VERSION_MM }, { "TURTLE_FHIR_VERSIONS", "3.0, 4.0, " + Constants.VERSION_MM },
{ "FHIR_MAJOR_VERSIONS", VersionUtilities.listSupportedMajorVersions()},
{ "FHIR_MINOR_VERSIONS", VersionUtilities.listSupportedVersions() },
{ "FHIR_CURRENT_VERSION", Constants.VERSION_MM}
}; };
@Override @Override
public String getName() { public String getName() {
return "validate"; return "validate";