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
links only contains members that are strings or link objects.
Link Objects
link objects MUST contain href // note the spec is too vague and could mean that either href or meta must be present, cc @dgeb
link objects MAY contain meta
link object contain no other members
Pagination Links
reach goal: if any of these is present then data for the document or relationship MUST be an array if present.
If any of the below is present, all MUST be present.
first MUST be null, a string, or a link object
last MUST be null, a string, or a link object
prev MUST be null, a string, or a link object
next MUST be null, a string, or a link object
Document Links
document links MAY contain pagination-links
document links MAY contain self
document links MAY contain related (when the document is for a relationship)
no other members // spec implies but does not outright say this
Resource Links
resource links MUST contain self// note: again, vague spec. Nothing else is described but self is described as a MAY. We are going to be more strict: if you define links for a resource it MUST be self
no other members // spec implies but does not outright say this
Relationship Links
relationship links MAY contain pagination-links if for a collection // we should warn for this though as ember-data cannot use them (yet)
relationship links MAY contain self// ember-data does not use this
relationship links MUST contain related// note: ember-data only uses this, so we upgrade to a MUST from a MAY
no other members // spec implies but does not outright say this
Spec Info
Document Links
Document links have self with is a string or a links object (href + optional meta).
They appear at the same level as the primary document (e.g. alongside the dataincludedmeta members). Documents that contain collections (data is an array) may also have pagination links.
Resource links have the same rules as document links, and appear at the top level of the resource. e.g. alongside typeidattributes and relationships. Resources cannot have pagination links.
Relationship links appear within the Relationship Object. They have more requirements than document and resource links. The related link is the most important aspect that is different. Relationships that represent collections may have pagination links. In ember-data we currently only utilize the related link. This is actually a bug, because we should fall back to the self link when related is not present and error if links is present without either.
An overview of things to validate.
Generic
link objects
.Link Objects
href
// note the spec is too vague and could mean that eitherhref
ormeta
must be present, cc @dgebmeta
Pagination Links
reach goal: if any of these is present then
data
for thedocument
orrelationship
MUST be anarray
if present.first
MUST be null, a string, or alink object
last
MUST be null, a string, or alink object
prev
MUST be null, a string, or alink object
next
MUST be null, a string, or alink object
Document Links
self
related
(when the document is for a relationship)Resource Links
self
// note: again, vague spec. Nothing else is described butself
is described as aMAY
. We are going to be more strict: if you define links for a resource it MUST beself
Relationship Links
self
// ember-data does not use thisrelated
// note: ember-data only uses this, so we upgrade to a MUST from a MAYSpec Info
Document Links
Document links have
self
with is astring
or alinks object
(href
+ optionalmeta
).They appear at the same level as the primary document (e.g. alongside the
data
included
meta
members). Documents that contain collections (data
is an array) may also havepagination
links.example:
Resource Links
Resource links have the same rules as
document
links, and appear at the top level of the resource. e.g. alongsidetype
id
attributes
andrelationships
. Resources cannot have pagination links.example:
Relationship Links
Relationship links appear within the
Relationship
Object. They have more requirements thandocument
andresource
links. Therelated
link is the most important aspect that is different. Relationships that represent collections may have pagination links. Inember-data
we currently only utilize therelated
link. This is actually a bug, because we should fall back to theself
link whenrelated
is not present and error iflinks
is present without either.The text was updated successfully, but these errors were encountered: