Merge remote-tracking branch 'origin/master'

This commit is contained in:
Grahame Grieve 2023-03-07 23:33:46 +11:00
commit 80665f142b
1 changed files with 16 additions and 16 deletions

View File

@ -139,13 +139,13 @@ public class ValidationService {
} else { } else {
File dir = new File(cliContext.getOutput()); File dir = new File(cliContext.getOutput());
if (!dir.isDirectory()) { if (!dir.isDirectory()) {
throw new Error("THe output location "+dir.getAbsolutePath()+" must be a directory for the output style "+renderer.getStyleCode()); throw new Error("The output location "+dir.getAbsolutePath()+" must be an existing directory for the output style "+renderer.getStyleCode());
} }
renderer.setFolder(dir); renderer.setFolder(dir);
} }
int ec = 0; int ec = 0;
if (r instanceof Bundle) { if (r instanceof Bundle) {
if (renderer.handlesBundleDirectly()) { if (renderer.handlesBundleDirectly()) {
renderer.render((Bundle) r); renderer.render((Bundle) r);
@ -153,7 +153,7 @@ public class ValidationService {
renderer.start(((Bundle) r).getEntry().size() > 1); renderer.start(((Bundle) r).getEntry().size() > 1);
for (Bundle.BundleEntryComponent e : ((Bundle) r).getEntry()) { for (Bundle.BundleEntryComponent e : ((Bundle) r).getEntry()) {
OperationOutcome op = (OperationOutcome) e.getResource(); OperationOutcome op = (OperationOutcome) e.getResource();
ec = ec + countErrors(op); ec = ec + countErrors(op);
renderer.render(op); renderer.render(op);
} }
renderer.finish(); renderer.finish();
@ -168,7 +168,7 @@ public class ValidationService {
renderer.render((OperationOutcome) r); renderer.render((OperationOutcome) r);
renderer.finish(); renderer.finish();
} }
if (cliContext.getOutput() != null && dst != null) { if (cliContext.getOutput() != null && dst != null) {
dst.close(); dst.close();
} }
@ -187,17 +187,17 @@ public class ValidationService {
if (issue.getSeverity() == OperationOutcome.IssueSeverity.FATAL || issue.getSeverity() == OperationOutcome.IssueSeverity.ERROR) if (issue.getSeverity() == OperationOutcome.IssueSeverity.FATAL || issue.getSeverity() == OperationOutcome.IssueSeverity.ERROR)
error++; error++;
} }
return error; return error;
} }
private ValidationOutputRenderer makeValidationOutputRenderer(CliContext cliContext) { private ValidationOutputRenderer makeValidationOutputRenderer(CliContext cliContext) {
String style = cliContext.getOutputStyle(); String style = cliContext.getOutputStyle();
// adding to this list? // adding to this list?
// Must document the option at https://confluence.hl7.org/display/FHIR/Using+the+FHIR+Validator#UsingtheFHIRValidator-ManagingOutput // Must document the option at https://confluence.hl7.org/display/FHIR/Using+the+FHIR+Validator#UsingtheFHIRValidator-ManagingOutput
// if you're going to make a PR, document the link where the outputstyle is documented, along with a sentence that describes it, in the PR notes // if you're going to make a PR, document the link where the outputstyle is documented, along with a sentence that describes it, in the PR notes
if (Utilities.noString(style)) { if (Utilities.noString(style)) {
if (cliContext.getOutput() == null) { if (cliContext.getOutput() == null) {
return new DefaultRenderer(); return new DefaultRenderer();
} else if (cliContext.getOutput().endsWith(".json")) { } else if (cliContext.getOutput().endsWith(".json")) {
return new NativeRenderer(FhirFormat.JSON); return new NativeRenderer(FhirFormat.JSON);
} else { } else {
@ -217,7 +217,7 @@ public class ValidationService {
return new NativeRenderer(FhirFormat.JSON); return new NativeRenderer(FhirFormat.JSON);
} else { } else {
System.out.println("Unknown output style '"+style+"'"); System.out.println("Unknown output style '"+style+"'");
return new DefaultRenderer(); return new DefaultRenderer();
} }
} }
@ -415,7 +415,7 @@ public class ValidationService {
for (String s : cliContext.getExtensions()) { for (String s : cliContext.getExtensions()) {
if ("any".equals(s)) { if ("any".equals(s)) {
validator.setAnyExtensionsAllowed(true); validator.setAnyExtensionsAllowed(true);
} else { } else {
validator.getExtensionDomains().add(s); validator.getExtensionDomains().add(s);
} }
} }
@ -435,7 +435,7 @@ public class ValidationService {
validator.setForPublication(cliContext.isForPublication()); validator.setForPublication(cliContext.isForPublication());
validator.setShowTimes(cliContext.isShowTimes()); validator.setShowTimes(cliContext.isShowTimes());
validator.setAllowExampleUrls(cliContext.isAllowExampleUrls()); validator.setAllowExampleUrls(cliContext.isAllowExampleUrls());
StandAloneValidatorFetcher fetcher = new StandAloneValidatorFetcher(validator.getPcm(), validator.getContext(), validator); StandAloneValidatorFetcher fetcher = new StandAloneValidatorFetcher(validator.getPcm(), validator.getContext(), validator);
validator.setFetcher(fetcher); validator.setFetcher(fetcher);
validator.getContext().setLocator(fetcher); validator.getContext().setLocator(fetcher);
validator.getBundleValidationRules().addAll(cliContext.getBundleValidationRules()); validator.getBundleValidationRules().addAll(cliContext.getBundleValidationRules());
@ -450,7 +450,7 @@ public class ValidationService {
} }
public String determineVersion(CliContext cliContext) throws Exception { public String determineVersion(CliContext cliContext) throws Exception {
return determineVersion(cliContext, null); return determineVersion(cliContext, null);
@ -493,9 +493,9 @@ public class ValidationService {
ok = false; ok = false;
System.out.println(" ...Unable to generate spreadsheet for "+cliContext.getSources().get(0)+": no way to generate a spreadsheet for a "+cr.fhirType()); System.out.println(" ...Unable to generate spreadsheet for "+cliContext.getSources().get(0)+": no way to generate a spreadsheet for a "+cr.fhirType());
} }
if (ok) { if (ok) {
System.out.println(" ...generated spreadsheet successfully"); System.out.println(" ...generated spreadsheet successfully");
} }
} }
} }