You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect interpretation of the HAL RFC wrt curies #97
Im having trouble with curies and what appears to be a difference in behavior in hyperclient vs hal-browser. Hyperclient is templating urls when not expected.
My server returns:
"curies": [
{
"name": "osdi",
"href": "http://opensupporter.github.io/osdi-docs/{rel}",
"templated": true
}
],
"osdi:tags": {
"href": "http://demo.osdi.io/api/v1/tags",
"title": "The collection of tags in the system"
},
In the hal browser, the curie is just used for documentation links and it does not reformat the link URL, which is already absolute.
But in hyperclient, it is reformatting the url for the link itself as:
perhaps we should separate the two issues and I'll move the query params out of this issue.
I think the issue of avoiding expansion when the href is already absolute should stay open.
I think there is a misinterpretation of how curies are supposed to be used in HAL. Curies are meant to shorten the key names in a _links hash, not the actual href associated with a link in the _links hash, as well as provide a link to the human readable documentation for said link.
Custom link relation types (Extension Relation Types in [RFC5988])
SHOULD be URIs that when dereferenced in a web browser provide
relevant documentation, in the form of an HTML page, about the
meaning and/or behaviour of the target Resource. This will improve
the discoverability of the API.
So actually, hyperclient shouldn't be doing any template expansion when dealing with curie syntax at all when navigating to a curied link.
The CURIE Syntax [W3C.NOTE-curie-20101216] MAY be used for brevity
for these URIs. CURIEs are established within a HAL document via a
set of Link Objects with the relation type "curies" on the root
Resource Object. These links contain a URI Template with the token
'rel', and are named via the "name" property.
The above demonstrates the relation "http://docs.acme.com/relations/
widgets" being abbreviated to "acme:widgets" via CURIE syntax.
When a curie is present, the href template inside the curie is how to find the documentation, not the resources. In the example above (from the spec), the resource is widgets, but the curie href refers to the documentation for wigets.
Activity
joshco commentedon Mar 12, 2016
pull request fix created
dblock commentedon Mar 12, 2016
This is clearly a bug, thanks for suggesting a fix.
dblock commentedon Mar 13, 2016
About this issue here, why are you using a curie in the
osdi:tagsexample? Should this just betags, in which case the issue is moot?joshco commentedon Mar 14, 2016
perhaps we should separate the two issues and I'll move the query params out of this issue.
I think the issue of avoiding expansion when the href is already absolute should stay open.
joshco commentedon Mar 14, 2016
I think there is a misinterpretation of how curies are supposed to be used in HAL. Curies are meant to shorten the key names in a _links hash, not the actual href associated with a link in the _links hash, as well as provide a link to the human readable documentation for said link.
https://tools.ietf.org/html/draft-kelly-json-hal-07#section-8.2
So actually, hyperclient shouldn't be doing any template expansion when dealing with curie syntax at all when navigating to a curied link.
When a curie is present, the href template inside the curie is how to find the documentation, not the resources. In the example above (from the spec), the resource is widgets, but the curie href refers to the documentation for wigets.
joshco commentedon Mar 14, 2016
Created pull request for that
#100
dblock commentedon Mar 14, 2016
Fixed in #101.
[-]Curie behavior conflict[/-][+]Incorrect interpretation of the HAL RFC wrt curies[/+]dblock commentedon Mar 15, 2016
Closed via #101.
Upgraded dependencies, fixed curies as per codegram/hyperclient#97.
Removed curies, see codegram/hyperclient#97.
Upgraded dependencies, fixed curies as per codegram/hyperclient#97.