FHIR Chat · Relative Canonical URLs · implementers

Stream: implementers

Topic: Relative Canonical URLs


view this post on Zulip James Agnew (Oct 15 2021 at 20:38):

Question about the Canonical datatype: Is it valid to put a relative URL in an element of type canonical?

There are a few places in the spec where it just makes sense to have local references between resources in a place that uses a canonical, e.g. PlanDefinition.definitionCanonical. The relevant bit of the spec on resolving canonical references states that the server should then fall back to direct resolution using the URL as a literal reference if a local version of the canonical resource cannot be found which implies to me that any literal reference is ok, including a relative one.

view this post on Zulip Lloyd McKenzie (Oct 15 2021 at 20:40):

No. Canonicals must be absolute.

view this post on Zulip Lloyd McKenzie (Oct 15 2021 at 20:41):

(Though they don't need to resolve)

view this post on Zulip James Agnew (Oct 15 2021 at 20:43):

Having an unresolvable absolute URL seems infinitely less useful to me than a resolvable local reference. Is this a good rule?

view this post on Zulip Lloyd McKenzie (Oct 15 2021 at 20:45):

Yes - because canonicals need to match the "url" element on the thing you're referencing - and there's no "local" context for that.

view this post on Zulip Grahame Grieve (Oct 15 2021 at 20:48):

No. Canonicals must be absolute

no

view this post on Zulip Lloyd McKenzie (Oct 15 2021 at 20:48):

They can be #123

view this post on Zulip Lloyd McKenzie (Oct 15 2021 at 20:48):

(to a contained resource)

view this post on Zulip Grahame Grieve (Oct 15 2021 at 20:49):

yes. https://hl7.org/fhir/references.html#canonical-fragments

view this post on Zulip Lloyd McKenzie (Oct 15 2021 at 20:50):

But you can't have a canonical that says "Questionnaire/123", right?

view this post on Zulip Grahame Grieve (Oct 15 2021 at 20:50):

right

view this post on Zulip James Agnew (Oct 15 2021 at 20:56):

hmm ok


Last updated: Apr 12 2022 at 19:14 UTC