From 487a36cbf20fd4ebfdbb1102a23b823571b3df40 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Fri, 22 Nov 2024 10:25:08 +1300 Subject: [PATCH] clarify that contentSchema holds a subschema and when/how it applies --- specs/jsonschema-validation.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/specs/jsonschema-validation.md b/specs/jsonschema-validation.md index be9f15b4..67389bb0 100644 --- a/specs/jsonschema-validation.md +++ b/specs/jsonschema-validation.md @@ -532,19 +532,24 @@ defined by [RFC 2046](#rfc2046). ### `contentSchema` -If the instance is a string, and if `contentMediaType` is present, this property -contains a schema which describes the structure of the string. +If the instance is a string, and if `contentMediaType` is present, this +property's subschema describes the structure of the string. This keyword MAY be used with any media type that can be mapped into JSON Schema's data model. Specifying such mappings is outside of the scope of this specification. -The value of this property MUST be a valid JSON schema. It SHOULD be ignored if -`contentMediaType` is not present. Accessing the schema through the schema -location IRI included as part of the annotation will ensure that it is correctly -processed as a subschema. Using the extracted annotation value directly is only -safe if the schema is an embedded resource with both `$schema` and an -absolute IRI `$id`. +The value of this property MUST be a valid JSON schema. The subschema is +produced as an annotation. + +Since `contentMediaType` is required to provide instruction on how to interpret +the string content, the annotation schema produced by this keyword has no +meaning if `contentMediaType` is not present. + +Accessing the schema through the schema location IRI included as part of the +annotation will ensure that it is correctly processed as a subschema. Using the +extracted annotation value directly is only safe if the subschema is an embedded +resource with both `$schema` and an absolute IRI `$id`. ### Example