HL7 / fhir-ig-publisher

Source code for the IG publisher
Apache License 2.0
67 stars 55 forks source link

Hard error for multiple ValueSets with same value of meta.source element #920

Open basharmsen opened 2 months ago

basharmsen commented 2 months ago

I'm writing an ImplementationGuide and when building it using the IG Publisher, I encounter the following error:

Publishing Content Failed: Name 'http://decor.nictiz.nl/fhir/4.0/mp-' already exists (value = "MedicatieToedieningRedenVanAfwijkenCodelijst") (00:10.313 / 02:00.008, 929Mb)
                                                                                                     (00:00.000 / 02:00.009, 929Mb)
Use -? to get command line help                                                                      (00:00.000 / 02:00.009, 929Mb)
                                                                                                     (00:00.000 / 02:00.009, 929Mb)
Stack Dump (for debugging):                                                                          (00:00.000 / 02:00.009, 929Mb)
org.hl7.fhir.utilities.json.JsonException: Name 'http://decor.nictiz.nl/fhir/4.0/mp-' already exists (value = "MedicatieToedieningRedenVanAfwijkenCodelijst")
        at org.hl7.fhir.utilities.json.model.JsonElement.check(JsonElement.java:44)
        at org.hl7.fhir.utilities.json.model.JsonObject.add(JsonObject.java:31)
        at org.hl7.fhir.utilities.json.model.JsonObject.add(JsonObject.java:68)
        at org.hl7.fhir.igtools.publisher.Publisher.saveCSList(Publisher.java:9079)
        at org.hl7.fhir.igtools.publisher.Publisher.generateSummaryOutputs(Publisher.java:8692)
        at org.hl7.fhir.igtools.publisher.Publisher.generate(Publisher.java:7597)
        at org.hl7.fhir.igtools.publisher.Publisher.createIg(Publisher.java:1194)
        at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:1016)
        at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:13007)

The package contains several ValueSets for which the meta.source element is the same, namely http://decor.nictiz.nl/fhir/4.0/mp-. This seems to be the cause of the issue. Removing these elements in the local package cache resolves the issue.

I'm not quite familiar with this element, but when reading the FHIR standard it seems to me that it should be allowed for a package to contain multiple Resources with the same value for the meta.source element. Even if this situation is not allowed according to the standard, a hard error as I encounter when building the package with the current version of the publisher seems inappropriate. A warning or a clearer error message would be more suitable.

Kind regards,

Bas Harmsen

grahamegrieve commented 2 months ago

it's not the source, it's the way that the files are generated. Attach a full example that reproduces this problem

basharmsen commented 2 months ago

I've written an Example that reproduces it. I've tried to keep it as simple as possible. An attempt to leave out the reference to the external package by adding my own ValueSets didn't succeed.

Example