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

Use $link instead of link in linked-json spec #83

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions draft-toomim-httpbis-linked-json-00.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ Table of Contents

1.1. Syntax

A Link is encoded as a JSON object with a field named "link":
A Link is encoded as a JSON object with a field named "$link":

{ "link": "/david-macaulay" }
{ "$link": "/david-macaulay" }

Any object with a field named "link" is interpreted as a Link. The
Any object with a field named "$link" is interpreted as a Link. The
value of the link field MUST be a string containing a URI [RFC3986].

Links MAY be embedded within arbitrary JSON:
Expand All @@ -87,13 +87,13 @@ Table of Contents

1.2. Escaping

To encode a field named "link" *without* creating a Link, prefix the
To encode a field named "$link" *without* creating a Link, prefix the
field with an underscore:

{ "_link": "this is not a link" }
{ "\\$link": "this is not a link" }

To encode "_link", prefix it with two underscores: "__link". To
encode "__link", use "___link", and so on.
To encode "\\$link", prefix it with four backslashes: "\\\\$link". And
so on.

1.3. Metadata

Expand All @@ -114,18 +114,18 @@ Table of Contents

Or a GraphQL [GRAPHQL] query:

{ "link": "/foo", "range": "(bar:9)[3,4]" }
{ "$link": "/foo", "range": "(bar:9)[3,4]" }


2. Related Work

See [MNOT] for a survey of related work. Linked JSON is most similar
to [JSONREF], but has the following differences:

- It names the special field "link" instead of "$ref".
- It names the special field "$link" instead of "$ref".

- It provides an escape hatch for when users need to encode the
string "link".
string "$link".

- It allows metadata to be specified on links.

Expand Down