w3c / json-ld-bp

JSON-LD 1.1 Best Practices Note
https://w3c.github.io/json-ld-bp/
Other
21 stars 7 forks source link

Consider context/frame documentation best practices #8

Open azaroth42 opened 6 years ago

azaroth42 commented 6 years ago

Consider best practices around the documentation of contexts and frames.

Options include:

To be considered during CR/PR phase as best practices. WG consensus is not to pursue this as a normative requirement.

gkellogg commented 6 years ago

Part of this can be separated: allowing HTML with embedded JSON-LD to be used as a context. Might consider using type="application/ld+json;profile="http://www.w3.org/ns/json-ld#context", presuming that @type on a script element can include such a parameter on the media type. In any case, it would fall back to using the first found script element of type application/ld+json.

iherman commented 6 years ago

Chasing down the @type attribute:

  1. HTML51 script element's type says:

    Setting the attribute to any other value means that the script is a data block […] Authors must use a valid MIME type that is not a JavaScript MIME type to denote data blocks.

  2. "valid mime type" in the same spec says:

    A string is a valid MIME type if it matches the media-type rule. In particular, a valid mime type may include MIME type parameters.

  3. media type is what is used on Content-Type, ie, in the @type attribute, and explicitly allows for parameters, which also includes profiles which we do register.

Note that the HTML spec also has a separate notion on valid mime type with no parameters, which it uses for, e.g., @accept. The fact that it does have attributes where the profile cannot be used reinforces the fact that otherwise it can

I.e, yes, we can use the profile in the <script> element.

pchampin commented 5 years ago

An ignored keyword in the context that embeds data (#32, #40)

The ability to add metadata to a context (or temps definitions, for that matter) would indeed be nice. I know that @rubensworks would have some use for it.

ajs6f commented 5 years ago

Just a note (half to self) that the introduction of Link ; rel=alternate should be considered for this issue. Whether we recommend using it for documentation or dis-recommend or something else, we should have a strongly-expressed opinion. 😉