From a7eebf99d6d5856e3e98d531310b2d9e4c112141 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 30 Mar 2021 11:21:38 -0700 Subject: [PATCH] further specify the format of iri-references throughout - $id cannot have a fragment at all, so separate it from the common definiiion - $ref, $dynamicRef, $recursiveRef must be a iri-reference to a schema location: when the fragment is non-empty, it must refer to an $anchor or a json-pointer - absoluteKeywordLocation in result outputs must use canonical IRIs/iri-references: either there is no fragment, or it is non-empty and encodes a json pointer Also fixed the output schema which erroneously still identifies absoluteSchemaLocation as a uri, not an iri. --- meta/core.json | 13 ++++++++----- output/schema.json | 4 +++- schema.json | 3 +-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/meta/core.json b/meta/core.json index 087ebd37..99c1e015 100644 --- a/meta/core.json +++ b/meta/core.json @@ -10,14 +10,15 @@ "type": ["object", "boolean"], "properties": { "$id": { - "$ref": "#/$defs/iriReferenceString", + "type": "string", + "format": "iri-reference", "$comment": "Non-empty fragments not allowed.", "pattern": "^[^#]*#?$" }, "$schema": { "$ref": "#/$defs/iriString" }, - "$ref": { "$ref": "#/$defs/iriReferenceString" }, + "$ref": { "$ref": "#/$defs/iriReferenceToSchemaString" }, "$anchor": { "$ref": "#/$defs/anchorString" }, - "$dynamicRef": { "$ref": "#/$defs/iriReferenceString" }, + "$dynamicRef": { "$ref": "#/$defs/iriReferenceToSchemaString" }, "$dynamicAnchor": { "$ref": "#/$defs/anchorString" }, "$vocabulary": { "type": "object", @@ -43,9 +44,11 @@ "type": "string", "format": "iri" }, - "iriReferenceString": { + "iriReferenceToSchemaString": { "type": "string", - "format": "iri-reference" + "format": "iri-reference", + "$comment": "any fragment must be empty, or match anchor or json-pointer syntax", + "pattern": "^[^#]*(#([A-Za-z_][-A-Za-z0-9.:_]*|/([^~]|~[01])*))?$" } } } diff --git a/output/schema.json b/output/schema.json index 72551fc6..5635e543 100644 --- a/output/schema.json +++ b/output/schema.json @@ -19,7 +19,9 @@ }, "absoluteKeywordLocation": { "type": "string", - "format": "uri" + "format": "iri", + "$comment": "any fragment must be non-empty, and use json-pointer syntax", + "pattern": "^[^#]*(#(/([^~]|~[01])*)*)?$" }, "instanceLocation": { "type": "string", diff --git a/schema.json b/schema.json index 066d86b9..c1ff2379 100644 --- a/schema.json +++ b/schema.json @@ -51,8 +51,7 @@ }, "$recursiveRef": { "$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".", - "type": "string", - "format": "uri-reference", + "$ref": "meta/core#/$defs/iriReferenceToSchemaString", "deprecated": true } }