json-schema-org / json-hyperschema-spec

A *future* location for the JSON Hyper-Schema I-D sources.
14 stars 4 forks source link

Hyper-Schema clarification: Is "One Link Per Target and Relation Type" still valid with "anchor"? #9

Open ryangalamb opened 4 years ago

ryangalamb commented 4 years ago

Now that we can change the context of a link using "anchor" and "anchorPointer", does the following statement from section 8.1 still hold true?

for each target resource and link relation type pair, schema authors SHOULD only define a single LDO.

Using anchors, we can define multiple different links using the same target by changing the context. For (contrived) example, if we're representing links in hierarchical data:

"links": [
  {
    "rel": "up",
    "href": "parent",
    "anchor": "parent/foo"
  },
  {
    "rel": "up",
    "href": "parent",
    "anchor": "parent/bar"
  }
]

As mentioned in the anchor example in section 9.4, using anchor with rel=top is an attractive solution to the lack of an IANA-registered "down" relationship.

While my example seems (to me) like it would be valid, it runs afoul of the "One Link Per Target and Relation Type" rule. Both links have a relationship type of "up" and a target of "parent".

Is the phrasing for section 8.1 a relic from before "anchor" was in the spec? Or am I misunderstanding something about how anchors are supposed to work?

handrews commented 4 years ago

@rjmill good catch. Yes, it should be something like "for each context, target, and link relation type triple, schema authors SHOULD..."