You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/2020-12/content/contentSchema.markdown
+45-10Lines changed: 45 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,15 +23,28 @@ related:
23
23
keyword: contentEncoding
24
24
---
25
25
26
-
The `contentSchema` keyword allows you to specify a schema that describes the structure of the content within a string instance, particularly when used in conjunction with the `contentMediaType` keyword. This is useful when the string instance contains data conforming to the JSON data model.
26
+
When the [`contentMediaType`]({{< ref "2020-12/content/contentmediatype" >}})
27
+
keyword is set to a media type that adheres to the JSON data model (like JSON
28
+
itself, [YAML](https://yaml.org) or [UBJSON](https://ubjson.org)), the
29
+
`contentSchema` keyword declares the schema that describes the corresponding
30
+
string instance value _after_ decoding it. This keyword does not affect
31
+
validation, but the evaluator will collect its value as an annotation.
27
32
28
-
However, it's important to note that `contentSchema` is merely an annotation and is not directly involved in the validation process. Instead, applications that consume JSON Schemas must use this information as they see fit. `contentSchema` must be a valid JSON Schema, but it is ignored if `contentMediaType` is absent.
33
+
{{<common-pitfall>}}
29
34
30
-
Applications utilizing JSON Schemas are expected to use the provided `contentSchema` to validate content if applicable. If a schema is provided but does not match the content structure, it should be considered an error.
35
+
The JSON Schema specification prohibits implementations, for security reasons,
36
+
from automatically attempting to decode, parse, or validate encoded data
37
+
without the consumer explicitly opting in to such behaviour. If you require
38
+
this feature, consult the documentation of your tooling of choice to see if it
39
+
supports content encoding/decoding and how to enable it.
40
+
41
+
{{</common-pitfall>}}
42
+
43
+
{{<constraint-warning `string`>}}
31
44
32
45
## Examples
33
46
34
-
{{<schema `Schema with 'contentSchema', 'contentMediaType' and 'contentEncoding' keyword`>}}
47
+
{{<schema `A schema that describes JSON object values encoded using Base 64`>}}
0 commit comments