Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSummary of JSON serialization approach #80
Comments
hvdsomp
added
the
linkset
label
Aug 30, 2017
This comment has been minimized.
This comment has been minimized.
case 1 is a mix of case 2 and case 3, right? it requires "post-processing" of the microsyntax, because the value is repeatable, but the attribute is not. |
This comment has been minimized.
This comment has been minimized.
or did i misunderstand and this is just a summary write-up and not intended to go intro the draft? in that case no issue here: this covers the solutions described in the individual issues, so we're all good. |
This comment has been minimized.
This comment has been minimized.
handrews
commented
Aug 30, 2017
@dret @hvdsomp I did define much of a mapping from HTTP headers to and from JSON at one point, and may well revive it depending on how we decide to handle hints in JSON Hyper-Schema: json-schema-org/json-schema-spec#296 |
This comment has been minimized.
This comment has been minimized.
On 2017-08-30 14:50, Henry Andrews wrote:
@dret <https://github.com/dret> @hvdsomp <https://github.com/hvdsomp> I
did define much of a mapping from HTTP headers to and from JSON at one
point, and may well revive it depending on how we decide to handle hints
in JSON Hyper-Schema: json-schema-org/json-schema-spec#296
in that case, maybe this is interesting (for the general HTTP header
space): https://tools.ietf.org/html/draft-reschke-http-jfv
|
This comment has been minimized.
This comment has been minimized.
handrews
commented
Aug 30, 2017
@dret thanks! That looks extremely relevant :-) I really need to dig through the draft list more often and in more detail. |
This comment has been minimized.
This comment has been minimized.
asbjornu
commented
Aug 31, 2017
•
No digging required. Just sign up for the relevant announcement list(s). :) |
This comment has been minimized.
This comment has been minimized.
@dret Allow me to clarify what I tried to do with the above:
|
added a commit
that referenced
this issue
Sep 1, 2017
This comment has been minimized.
This comment has been minimized.
I checked whether/how the above CASES 1 through 6 could be handled using the syntax proposed by @stain in a comment in #89. The result is below. Comments:
Here goes, assuming the link anchor is http://example.net/bar: CASE 1 native: http://example.org/; rel="start"; native: http://example.org/; rel="start home"; Case 2: native: http://example.org/; rel="start"; title="this" Case 3: native: http://example.org/; rel="next"; hreflang="en de" Case 4: native: http://example.org/; rel="next"; title*="UTF-8'de'n%c3%a4chstes%20Kapitel" Case 5: native: http://example.org/; rel="start"; param="x" native: http://example.org/; rel="start"; param="x y" native: http://example.org/; rel="start"; param="x"; param="y" Case 6: native: http://example.org/; rel="next"; x*="UTF-8'de'n%c3%a4chstes%20Kapitel" |
hvdsomp commentedAug 30, 2017
•
edited
This is not really an "issue" per se, but I felt it would be good to have an overview of what I think is the current consensus in one spot. So, here goes.
Overall serialization approach:
CASE 1 - Relation Type
=> applies to: rel, rev
APPROACH — — array of relation types to convey one or more typed link(s) that share a context and target URI
PATTERN — — “rel” : [“relname”]
PATTERN — — “rel” : [“relname” , “relname”]
native: http://example.org/; rel="start";
JSON: [ { "href":"http://example.org/", "rel":[ "start" ]} ]
native: http://example.org/; rel="start home";
JSON: [ { "href":"http://example.org/", "rel":["start", "home" ] } ]
CASE 2 - Target Attributes, Serialization Defined, Token-style, Not Repeatable
=> applies to: title, type, media
native: http://example.org/; rel="start"; title="this"
JSON: [ { "href":"http://example.org/", "rel":[ "start" ] , title:"this"} ]
CASE 3 - Target Attributes, Serialization Defined, Token-style, Repeatable
=> applies to: hreflang
APPROACH — — array of attribute values
PATTERN — — “hreflang” : [“language”]
PATTERN — — “hreflang” : [“language” , “language”]
native: http://example.org/; rel="next"; hreflang="en de"
JSON: [ { "href":"http://example.org/", "rel":"next", "hreflang":["en","de"]
CASE 4 - Target Attributes, Serialization Defined, Token-star-style, Not Repeatable
=> applies to: title*
APPROACH — — array of attribute value & associated language
PATTERN — — “title*” : [“title” , “language”]
native: http://example.org/; rel="next"; title*="UTF-8'de'n%c3%a4chstes%20Kapitel"
JSON: [ { "href":"http://example.org/", "rel":"next", "title*":["nächstes Kapitel", "de"] } ]
CASE 5 - Target Attributes, Extension Attributes, Token-style, Unknown Repeatability
=> applies to e.g.: param
APPROACH — — array of one or more attribute values
PATTERN — — “param” : [“param-value”]
PATTERN — — “param” : [“param-value” , “param-value”]
native: http://example.org/; rel="start"; param="x"
JSON: [ { "href":"http://example.org/", "rel":"start", "param":["x"] } ]
native: http://example.org/; rel="start"; param="x y"
JSON: [ { "href":"http://example.org/", "rel":"start", "param":["x y"] } ]
native: http://example.org/; rel="start"; param="x"; param="y"
JSON: [ { "href":"http://example.org/", "rel":"start", "param":["x","y"] } ]
CASE 6 - Target Attributes, Extension Attributes, Token-star-style, Unknown Repeatability
=> applies to e.g.: param*
APPROACH — — array of one or more arrays of attribute value & associated language
PATTERN — — param* : [[“param-value” , “language”]]
PATTERN — — param* : [[“param-value” , “language”] , [“param-value” , “language”]]
native: http://example.org/; rel="next"; x*="UTF-8'de'n%c3%a4chstes%20Kapitel"
JSON: [ { "href":"http://example.org/", "rel":"next", "x*":[["nächstes Kapitel", "de"]] } ]