Stream: shorthand
Topic: Canonical URLs containing #
Josh Mandel (Feb 17 2022 at 19:45):
One other naming issue I'm running into: if I want to use an externally defined extension with a URL containing a hash (say: https://example.org/ext#favorite
), I see a parsing error when I do:
* extension contains https://example.org/ext#favorite named fave 1..1
i.e.
expecting {'MS', 'SU', 'TU', 'N', 'D', 'codes', 'valueset', 'system', NUMBER, SEQUENCE}
Quotes don't seem to help; is there another way?
Chris Moesel (Feb 17 2022 at 19:49):
I think you mean containing a hash (not a *slash)... and what I expect is happening here is that SUSHI is erroneously parsing this as a code, because FSH syntax for codes is system#code
(and system can be a URL). We should probably try to tweak the grammar to support that.
In the mean time, there is a workaround. Just use an alias like so:
Alias: FAV = https://example.org/ext#favorite
Profile: MyPatient
Parent: Patient
* extension contains FAV named fave 1..1
Josh Mandel (Feb 17 2022 at 19:52):
Yes, updated my post when I saw the error!) Alias workaround is good, thanks!
Chris Moesel (Feb 17 2022 at 20:08):
Lloyd McKenzie (Feb 17 2022 at 20:24):
Canonical URLs should NOT contain a hash
Lloyd McKenzie (Feb 17 2022 at 20:25):
We use hash in some cases to refer to an element within a reference, so including them in the URL is bad practice.
Josh Mandel (Feb 17 2022 at 20:51):
@Lloyd McKenzie do we document this expectation? If not, we should.
Lloyd McKenzie (Feb 17 2022 at 23:53):
Actually, I guess I lied. Canonical references are explicitly defined as allowing '#'. But having that in a code system canonical is definitely going to cause tooling grief. @Grahame Grieve?
Elliot Silver (Feb 18 2022 at 00:50):
Are there uses for # in canonicals other than (IIRC) referencing a particular element (in a StructureDefinition) or item (in a Questionnaire)? I suspect we allow # in canonicals to support those uses, but the language was sloppy and didn't restrict it to those uses.
Brian Postlethwaite (Feb 21 2022 at 23:00):
Questionnaire.item.definition is one place, and I think in the last few days there was a use case in the CodeSystem that Michael Lawley identified.
Last updated: Apr 12 2022 at 19:14 UTC