Skip to content

Commit

Permalink
further specify the format of iri-references throughout
Browse files Browse the repository at this point in the history
- $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.
  • Loading branch information
karenetheridge committed Sep 5, 2022
1 parent 2c70d2e commit 1e16053
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
13 changes: 8 additions & 5 deletions meta/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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])*))$"
}
}
}
4 changes: 3 additions & 1 deletion output/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
},
"$recursiveRef": {
"$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".",
"type": "string",
"format": "uri-reference",
"$ref": "meta/core#/$defs/iriReferenceToSchemaString",
"deprecated": true
}
}
Expand Down

0 comments on commit 1e16053

Please sign in to comment.