Exception in thread "main" org.hl7.fhir.exceptions.FHIRException: Unable to find definitions at URL 'https://hapi.fhir.org/baseR4/StructureDefinition/profile-example-task-input-no-slice-dmuylwyk': Bad Request
at org.hl7.fhir.validation.cli.utils.ProfileLoader.loadProfileFromUrl(ProfileLoader.java:32)
at org.hl7.fhir.validation.cli.utils.ProfileLoader.loadProfileSource(ProfileLoader.java:18)
at org.hl7.fhir.validation.ValidationEngine.loadProfile(ValidationEngine.java:553)
at org.hl7.fhir.validation.cli.tasks.ValidateTask.executeTask(ValidateTask.java:57)
at org.hl7.fhir.validation.ValidatorCli.readParamsAndExecuteTask(ValidatorCli.java:374)
at org.hl7.fhir.validation.ValidatorCli.readParamsAndExecuteTask(ValidatorCli.java:171)
at org.hl7.fhir.validation.ValidatorCli.main(ValidatorCli.java:206)
Caused by: java.io.IOException: Bad Request
at org.hl7.fhir.utilities.http.HTTPResult.checkThrowException(HTTPResult.java:50)
at org.hl7.fhir.validation.cli.utils.ProfileLoader.loadProfileFromUrl(ProfileLoader.java:29)
... 6 more
Caused by: org.hl7.fhir.utilities.http.HTTPResultException: Invalid HTTP response 400 from https://hapi.fhir.org/baseR4/StructureDefinition/profile-example-task-input-no-slice-dmuylwyk?nocache=1720813749780 (Bad Request) (Response in /var/folders/3g/bqtb98z97c398m9f_b2k3rbc0000gn/T/http-log/fhir-http-2.log)
at org.hl7.fhir.utilities.http.HTTPResult.checkThrowException(HTTPResult.java:49)
... 7 more
Beyond that, this still won't resolve because by default an HTML file is returned. Attempting to hack past that by appending a \?_format\=json then makes the canonical URL incorrect indicated by -profile unmatchable.
In the documentation, it's clear that the expected path is to load a full IG first. However, this greatly slows simple reproduction, as then IG packaging must get involved instead of simply validating against a single canonical URL.
Can we put some effort into canonical URL resolution for the -profile param?
The
-profile
param has some issues trying to resolve from a canonical URL when the profile hasn't been specified in a loaded IG.Try running the following with the attached file bp.json:
An exception will be thrown:
One reason for this is that a
nocache
param gets added to the URL when GETing: https://github.com/hapifhir/org.hl7.fhir.core/blob/a09c712c87a9d265dadb4ce4037586e2a8dc1b4c/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/utils/ProfileLoader.java#L28Beyond that, this still won't resolve because by default an HTML file is returned. Attempting to hack past that by appending a
\?_format\=json
then makes the canonical URL incorrect indicated by-profile
unmatchable.In the documentation, it's clear that the expected path is to load a full IG first. However, this greatly slows simple reproduction, as then IG packaging must get involved instead of simply validating against a single canonical URL.
Can we put some effort into canonical URL resolution for the
-profile
param?