apigovau / national-api-design-standards

Australian National API Design Standards
35 stars 15 forks source link

Inconsistency in HATEOAS "href" requirements #3

Open TomChapple opened 4 years ago

TomChapple commented 4 years ago

The Link Relation is described in two different places in the standards: an overview in "Naming Conventions - Link Relation Names" and detailed description in "Hypermedia - Link Description Object". As these two sections are different and do not link between one another, it looks like an inconsistency has appeared regarding the "href" property of this object.

The overview describes the "href" property as follows:

href - string containing the absolute or relative URL to the resource

In comparison, the detailed description in "Hypermedia - Link Description Object" lists a number of requirements for each property. One in particular partially contradicts the overview's description:

Use ONLY absolute URIs as a value for href property. ...

Specifically, where the overview states that either absolute or relative URIs can be used (even using a relative URI in an example close by), the detailed description specifies that only absolute URIs are permitted before further describing the philosophy and method for determining it.

Given that this topic on absolute vs relative URIs continues to be debated to my knowledge, ensuring that these requirements are consistent would be very useful.

Perhaps there should be a link from the "Naming Conventions - Link Relation Names" section to the "Hypermedia - Link Description Object" section given that the latter has more detail? This would free up the former to have simpler descriptions (e.g. "href - string containing the URI to the linked resource") and providing a source of truth to the nature of the URI.

jordanwalsh23 commented 4 years ago

Thanks @TomChapple for the feedback. I'll raise a PR for this change shortly for review and approval by the tech standards group.