hapifhir / hapi-fhir

šŸ”„ HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2.04k stars 1.33k forks source link

HAPI CLI: Invalid attribute value "4.1.0": Unknown FHIRVersion code '4.1.0' #1227

Open voldedore opened 5 years ago

voldedore commented 5 years ago

Describe the bug The latest hapi-fhir-cli (3.7.0 Gale) (upload examples) fails to parse example.json (downloaded from http://build.fhir.org/examples-json.zip).

Full error code:

------------------------------------------------------------
šŸ”„  HAPI FHIR 3.7.0 - Command Line Tool
------------------------------------------------------------
Process ID                      : 24589@VTVINH-ARCH
Max configured JVM memory (Xmx) : 1.7GB
Detected Java version           : 1.8.0_202
------------------------------------------------------------
2019-03-06 10:00:58 [main] INFO  c.u.f.c.ExampleDataUploader Found example codesystem-tldc.json - CodeSystem - 6715 chars
2019-03-06 10:01:02 [main] INFO  c.u.f.c.ExampleDataUploader Found example valueset-request-resource-types.json - ValueSet - 2176 chars
2019-03-06 10:01:02 [main] INFO  c.u.f.c.ExampleDataUploader Found example valueset-device-definition-status.json - ValueSet - 1894 chars
2019-03-06 10:01:03 [main] INFO  c.u.f.c.ExampleDataUploader Found example specimen-example-pooled-serum.json - Specimen - 2859 chars
2019-03-06 10:01:03 [main] INFO  c.u.f.c.ExampleDataUploader FAILED to parse example capabilitystatement-example.json

ca.uhn.fhir.parser.DataFormatException: Invalid attribute value "4.1.0": Unknown FHIRVersion code '4.1.0'
    at ca.uhn.fhir.parser.StrictErrorHandler.invalidValue(StrictErrorHandler.java:49)
    at ca.uhn.fhir.parser.LenientErrorHandler.invalidValue(LenientErrorHandler.java:90)
    at ca.uhn.fhir.parser.ParserState$PrimitiveState.attributeValue(ParserState.java:1290)
    at ca.uhn.fhir.parser.ParserState.attributeValue(ParserState.java:66)
    at ca.uhn.fhir.parser.JsonParser.parseChildren(JsonParser.java:1033)
    at ca.uhn.fhir.parser.JsonParser.parseChildren(JsonParser.java:938)
    at ca.uhn.fhir.parser.JsonParser.doParseResource(JsonParser.java:183)
    at ca.uhn.fhir.parser.JsonParser.doParseResource(JsonParser.java:165)
    at ca.uhn.fhir.parser.BaseParser.parseResource(BaseParser.java:648)
    at ca.uhn.fhir.parser.BaseParser.parseResource(BaseParser.java:697)
    at ca.uhn.fhir.parser.BaseParser.parseResource(BaseParser.java:707)
    at ca.uhn.fhir.cli.ExampleDataUploader.getBundleFromFileR4(ExampleDataUploader.java:269)
    at ca.uhn.fhir.cli.ExampleDataUploader.getBundleFromFile(ExampleDataUploader.java:76)
    at ca.uhn.fhir.cli.ExampleDataUploader.run(ExampleDataUploader.java:642)
    at ca.uhn.fhir.cli.BaseApp.run(BaseApp.java:247)
    at ca.uhn.fhir.cli.App.main(App.java:43)

... There are more with the same error

To Reproduce Steps to reproduce the behavior:

  1. Run ./hapi-fhir-cli upload-examples -t http://localhost:10009/api -c -v r4 -l 10
  2. See error

Expected behavior The cli should have successfully imported example data to the fhir server target.

Environment (please complete the following information):

Additional context Structure: R4

ggojang commented 5 years ago

hapi-fhir/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ExampleDataUploader.java

line 628:

CHANGE specUrl = "http://build.fhir.org/examples-json.zip"; TO specUrl = "http://hl7.org/fhir/R4/examples-json.zip";

voldedore commented 5 years ago

Thanks for replying @ggojang, I'll test it as soon as I've got some spare time and I'd be happy to make a PR if things are alright.

darthcav commented 3 years ago

The solution proposed by @ggojang works like a charm for the CLI app in version 5.4.0. It should be patched as soon as possible.