Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allowing multiple link relation types in rel in the JSON serialization #122

Open
dret opened this issue Aug 28, 2019 · 3 comments

Comments

@dret
Copy link
Owner

commented Aug 28, 2019

@dret dret added the linkset label Aug 28, 2019

@gabesullice

This comment has been minimized.

Copy link

commented Aug 28, 2019

Here is my formatted message:


I think there might be an inconsistency between application/linkset and application/linkset+json

The link header serialization says "The rel parameter can, however, contain multiple link relation types." https://tools.ietf.org/html/rfc8288#section-3.3

However, in the JSON serialization you define, it appears that it can only support a single link relation type.

Unless you mean for user agents to:

a. deduplicate links that share a common context and target but a different rel
b. interpret the object property name as a space-delimited set of relation types

If either of those is the case, I think it would be good to explicitly give that example.

OTOH, I think I would prefer if your link object replaced the rel as object property name with the constant, target, and make rel a sibling of href, permitting it to be an array

@hvdsomp

This comment has been minimized.

Copy link
Collaborator

commented Aug 28, 2019

Could it be that you are reacting to version 3 of the Internet Draft, and not version 4 that was released today? See https://tools.ietf.org/html/draft-wilde-linkset-04

@gabesullice

This comment has been minimized.

Copy link

commented Aug 28, 2019

@hvdsomp, I followed @dret's tweet directly to version 4.

Here is the line in question: https://github.com/dret/I-D/blob/master/linkset/draft-wilde-linkset-04.txt#L351

Specifically:

For each distinct relation type that the link context has with link targets, a link context object MUST have an additional member. ... The name of this member expresses the relation type of the link as follows:

  • ... the name of this member is the registered name of the relation type.

Consequently, a link context object can have one ore more link target objects but those links can only have a single relation type.

The example also makes this clear:

   {
     "linkset":
       [
         { "anchor":"http://example.net/bar",
           "item": [
                 {"href": "http://example.com/foo1"},
                 {"href": "http://example.com/foo2"}
           ]
         }
       ]
   }

Which we can reformat into a link header as:

Link: <http://example.com/foo1>; rel="item" anchor="http://example.net/bar" ,
  <http://example.com/foo1>; rel="item" anchor="http://example.net/bar"

However, how would one serialize this link header back into JSON?

Link: <http://example.com/foo1>; rel="item http://example.net/relation/other1" anchor="http://example.net/bar",
  <http://example.com/foo2>; rel="item http://example.net/relation/other2" anchor="http://example.net/bar"

It's not clear in the current draft (v4). There is an example of a link header with multiple link relation types in RFC 8288 (search for http://example.net/relation/other).

What I proposed at the end of my message would look like this:

   {
     "linkset":
       [
         { "anchor":"http://example.net/bar",
           "target": [
                 {"href": "http://example.com/foo1",
                  "rel": ["item", "http://example.net/relation/other1"]},
                 {"href": "http://example.com/foo2",
                  "rel": ["item", "http://example.net/relation/other2"]}
           ]
         }
       ]
   }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.