Skip to content

Moving "media" into validation (as "contentEncoding"+"contentMediaType") #384

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

Merged
merged 6 commits into from
Sep 14, 2017

Conversation

dlax
Copy link
Member

@dlax dlax commented Aug 31, 2017

Addresses the other part of #363 (see also #378) by moving the "media" keyword into the validation document and splitting it into "contentEncoding"+"contentMediaType" in a (new) dedicated section similar to the one about "format".

All references to "multimedia" are also removed from the Hyper-Schema document. I kept most of the original textual content and examples as a first step.

Copy link
Contributor

@handrews handrews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! I found one tiny leftover "media"-ism to fix.

Additionally, could you add an "Implementation requirements" section analogous to that for "format"? I think the requirements are similar- validators MAY validate some or all possible encodings/media types. But as that is likely to be burdensome if anything this should be an even weaker requirement than format. Mostly, these properties signal to applications how they can handle the field if it is a valid string to start with.

Unlike with "format", we won't be enumerating a set of supported media types, so no need to include the extensibility paragraph, I think.

@@ -963,7 +873,7 @@ GET /foo/
"properties": {
"message": {
"description": "Re-interpret `message` as HTML",
"media": {
"contentMediaType": {
"type": "text/html"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You no longer need the sub-field "type" here :-)

@handrews handrews added this to the draft-07 (wright-*-02) milestone Aug 31, 2017
@handrews handrews requested a review from Relequestual August 31, 2017 20:43
@dlax dlax force-pushed the media-in-validation branch from 8f83782 to f85ee90 Compare September 1, 2017 08:20
@handrews
Copy link
Contributor

@dlax can you rebase and fix the conflicts?

@Relequestual does this change look good to you? Similar to the readOnly move, but I think less controversial because semantic description of content (as opposed to usage) pretty clearly belongs with format in the validation spec. It has nothing to do with hypermedia at all (unless you think media types are exclusive to hypermedia, which I do not, but that's the only reason I can think of that they were in hyper-schema at all).

@dlax dlax force-pushed the media-in-validation branch from f85ee90 to fbd958c Compare September 11, 2017 18:46
Copy link
Member

@Relequestual Relequestual left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor question, but otherwise this looks good to go. I'm all for including basic examples!

<section title="Implementation requirements">
<t>
Implementations MAY support keywords defined in this section.
Should they choose to do so, they SHOULD offer an option to disable validation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason / use case for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to mirror what's stated for "format" keyword (in "Implementation requirements" section). The reasoning is that "format" and "media*" keywords are semantically similar, so implementations should treat them similarly.

dlax and others added 5 commits September 13, 2017 10:46
…alidation

Definition of "media" property (an object in Hyper-Schema) is moved into
two properties "contentMediaType" and "contentEncoding" in the
validation specification.

This addresses the other part of json-schema-org#363, which states that some keywords
historically in the Hyper-Schema specification would be better in
the Validation document. The main argument for moving keywords such as
"media" is that the Hyper-Schema document could then only focus on
describing the hypermedia linking model.

The new keywords are described in a dedicated section "String-encoding
non-JSON data". Part of the previous content was moved into a forewords
section.
And move the sentence about "multimedia documents" back to Validation
document where it still makes sense.
…iaType}

Similar to the one of "format" keyword, without the extensibility note.
@dlax dlax force-pushed the media-in-validation branch from fbd958c to 0d205ae Compare September 13, 2017 08:51
@dlax
Copy link
Member Author

dlax commented Sep 13, 2017

@dlax can you rebase and fix the conflicts?

Done.

@handrews handrews merged commit 1d8963e into json-schema-org:master Sep 14, 2017
@dlax dlax deleted the media-in-validation branch September 14, 2017 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants