diff --git a/hyper-schema.json b/hyper-schema.json index e8c30419..a342e497 100644 --- a/hyper-schema.json +++ b/hyper-schema.json @@ -57,17 +57,6 @@ "items": { "$ref": "http://json-schema.org/draft-06/links#" } - }, - "media": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "binaryEncoding": { - "type": "string" - } - } } }, "links": [ diff --git a/jsonschema-hyperschema.xml b/jsonschema-hyperschema.xml index 5f5f2a0b..d48264a2 100644 --- a/jsonschema-hyperschema.xml +++ b/jsonschema-hyperschema.xml @@ -1,6 +1,5 @@ @@ -123,8 +122,6 @@ This document describes how JSON Schema can be used to define hyperlinks on instance data. - It also defines how to provide additional information required to interpret JSON - data as rich multimedia documents. As with all JSON Schema keywords, all the keywords described in the "Schema @@ -133,8 +130,7 @@
- Here is an example JSON Schema defining hyperlinks, and providing a multimedia - interpretation for the "imgData" property: + Here is an example JSON Schema defining hyperlinks: - This example schema defines the properties of the instance. For the "imgData" - property, it specifies that that it should be base64-decoded and the resulting - binary data treated as a PNG image. - It also defines link relations for the instance, with URIs incorporating values - from the instance. + This example schema defines the properties of the instance as well as link + relations for the instance, with URIs incorporating values from the instance. "id" probably should not normally be a required keyword, since new instances will have an unknown "id" property until is it assigned by the server. @@ -192,25 +177,6 @@
-
- - An example of a JSON instance described by the above schema might be: - - - - - - The base-64 data has been abbreviated for readability. - -
-
Hyper-schema keywords can be applied when the instance is valid against @@ -338,94 +304,6 @@
-
- - The "media" property indicates that this instance contains non-JSON data encoded - in a JSON string. - It describes the type of content and how it is encoded. - - - The value of this property MUST be an object. - The value of this property SHOULD be ignored if the instance described is not a - string. - - -
- - The value of the "media" keyword MAY contain any of the following - properties: - - -
- - If the instance value is a string, this property defines that the string - SHOULD be interpreted as binary data and decoded using the encoding - named by this property. - RFC 2045, Sec 6.1 lists the possible - values for this property. - -
- -
- - The value of this property must be a media type, as defined by - RFC 2046. This property defines the media - type of instances which this schema defines. - - - - If the "binaryEncoding" property is not set, but the instance value is a - string, then the value of this property SHOULD specify a text document - type, and the character set SHOULD be the character set into which the - JSON string value was decoded (for which the default is Unicode). - -
-
- -
-
- - Here is an example schema, illustrating the use of "media": - - - - - - Instances described by this schema should be strings, and their values - should be interpretable as base64-encoded PNG images. - -
- -
- - Another example: - - - - - - Instances described by this schema should be strings containing HTML, - using whatever character set the JSON string was decoded into (default - is Unicode). - -
-
-
@@ -1010,9 +888,7 @@ GET /foo/ "properties": { "message": { "description": "Re-interpret `message` as HTML", - "media": { - "type": "text/html" - } + "contentMediaType": "text/html" } } } @@ -1310,7 +1186,6 @@ GET /foo/ - &rfc2045; &rfc2119; &rfc3986; diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index 0e9a5d37..69f122d6 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -1,6 +1,8 @@ + + @@ -993,6 +995,116 @@
+
+ +
+ + Properties defined in this section indicate that an instance contains + non-JSON data encoded in a JSON string. + They describe the type of content and how it is encoded. + + + These properties provide additional information required to interpret JSON data + as rich multimedia documents. + +
+ +
+ + Implementations MAY support keywords defined in this section. + Should they choose to do so, they SHOULD offer an option to disable validation + for these keywords. + +
+ +
+ + + If the instance value is a string, this property defines that the string + SHOULD be interpreted as binary data and decoded using the encoding + named by this property. + RFC 2045, Sec 6.1 lists the possible + values for this property. + + + + The value of this property MUST be a string. + + + + The value of this property SHOULD be ignored if the instance described is not a + string. + + +
+ +
+ + The value of this property must be a media type, as defined by + RFC 2046. This property defines the media + type of instances which this schema defines. + + + + The value of this property MUST be a string. + + + + The value of this property SHOULD be ignored if the instance described is not a + string. + + + + If the "contentEncoding" property is not present, but the instance value is a + string, then the value of this property SHOULD specify a text document type, + and the character set SHOULD be the character set into which the JSON string + value was decoded (for which the default is Unicode). + +
+ +
+
+ + Here is an example schema, illustrating the use of "contentEncoding" and + "contentMediaType": + + + + + + Instances described by this schema should be strings, and their values + should be interpretable as base64-encoded PNG images. + +
+ +
+ + Another example: + + + + + + Instances described by this schema should be strings containing HTML, using + whatever character set the JSON string was decoded into (default is + Unicode). + +
+
+ +
+
JSON Schema validation defines a vocabulary for JSON Schema core and concerns all @@ -1034,6 +1146,8 @@ &RFC1034; + &RFC2045; + &RFC2046; &RFC2673; &RFC3339; &RFC3986; diff --git a/schema.json b/schema.json index 1d31d8e4..3c5b2981 100644 --- a/schema.json +++ b/schema.json @@ -152,6 +152,8 @@ ] }, "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, "if": {"$ref": "#"}, "then": {"$ref": "#"}, "else": {"$ref": "#"},