Skip to content

Commit

Permalink
further specify the format of uri-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 uri-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
URIs/uri-references: either there is no fragment, or it is non-empty and
encodes a json pointer
  • Loading branch information
karenetheridge committed Mar 30, 2021
1 parent 0e08f03 commit 22c5cd1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 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/uriReferenceString",
"type": "string",
"format": "uri-reference",
"$comment": "Non-empty fragments not allowed.",
"pattern": "^[^#]*#?$"
},
"$schema": { "$ref": "#/$defs/uriString" },
"$ref": { "$ref": "#/$defs/uriReferenceString" },
"$ref": { "$ref": "#/$defs/uriReferenceToSchemaString" },
"$anchor": { "$ref": "#/$defs/anchorString" },
"$dynamicRef": { "$ref": "#/$defs/uriReferenceString" },
"$dynamicRef": { "$ref": "#/$defs/uriReferenceToSchemaString" },
"$dynamicAnchor": { "$ref": "#/$defs/anchorString" },
"$vocabulary": {
"type": "object",
Expand All @@ -43,9 +44,11 @@
"type": "string",
"format": "uri"
},
"uriReferenceString": {
"uriReferenceToSchemaString": {
"type": "string",
"format": "uri-reference"
"format": "uri-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": "uri",
"$comment": "any fragment must be non-empty, and use json-pointer syntax",
"pattern": "^[^#]*(#/([^~]|~[01])*)$"
},
"instanceLocation": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
},
"$recursiveRef": {
"$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".",
"$ref": "meta/core#/$defs/uriReferenceString",
"$ref": "meta/core#/$defs/uriReferenceToSchemaString",
"deprecated": true
}
}
Expand Down

0 comments on commit 22c5cd1

Please sign in to comment.