Skip to content

Commit

Permalink
Merge commit '8fcfc3a674a7188a4fcc822b7a91efb3e0422a20'
Browse files Browse the repository at this point in the history
* commit '8fcfc3a674a7188a4fcc822b7a91efb3e0422a20':
  Squashed 'json/' changes from b41167c74..54f3784a8
  • Loading branch information
Julian committed Apr 30, 2024
2 parents 30b7537 + 8fcfc3a commit ebc90bb
Show file tree
Hide file tree
Showing 36 changed files with 689 additions and 747 deletions.
1 change: 1 addition & 0 deletions json/remotes/draft-next/format-assertion-false.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/next/vocab/core": true,
"https://json-schema.org/draft/next/vocab/format-assertion": false
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/next/meta/core" },
{ "$ref": "https://json-schema.org/draft/next/meta/format-assertion" }
Expand Down
1 change: 1 addition & 0 deletions json/remotes/draft-next/format-assertion-true.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/next/vocab/core": true,
"https://json-schema.org/draft/next/vocab/format-assertion": true
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/next/meta/core" },
{ "$ref": "https://json-schema.org/draft/next/meta/format-assertion" }
Expand Down
1 change: 1 addition & 0 deletions json/remotes/draft-next/metaschema-no-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/next/vocab/applicator": true,
"https://json-schema.org/draft/next/vocab/core": true
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/next/meta/applicator" },
{ "$ref": "https://json-schema.org/draft/next/meta/core" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"https://json-schema.org/draft/next/vocab/core": true,
"http://localhost:1234/draft/next/vocab/custom": false
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/next/meta/validation" },
{ "$ref": "https://json-schema.org/draft/next/meta/core" }
Expand Down
1 change: 1 addition & 0 deletions json/remotes/draft2019-09/metaschema-no-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/2019-09/vocab/applicator": true,
"https://json-schema.org/draft/2019-09/vocab/core": true
},
"$recursiveAnchor": true,
"allOf": [
{ "$ref": "https://json-schema.org/draft/2019-09/meta/applicator" },
{ "$ref": "https://json-schema.org/draft/2019-09/meta/core" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"https://json-schema.org/draft/2019-09/vocab/core": true,
"http://localhost:1234/draft/2019-09/vocab/custom": false
},
"$recursiveAnchor": true,
"allOf": [
{ "$ref": "https://json-schema.org/draft/2019-09/meta/validation" },
{ "$ref": "https://json-schema.org/draft/2019-09/meta/core" }
Expand Down
1 change: 1 addition & 0 deletions json/remotes/draft2020-12/format-assertion-false.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/2020-12/vocab/core": true,
"https://json-schema.org/draft/2020-12/vocab/format-assertion": false
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" },
{ "$ref": "https://json-schema.org/draft/2020-12/meta/format-assertion" }
Expand Down
1 change: 1 addition & 0 deletions json/remotes/draft2020-12/format-assertion-true.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/2020-12/vocab/core": true,
"https://json-schema.org/draft/2020-12/vocab/format-assertion": true
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" },
{ "$ref": "https://json-schema.org/draft/2020-12/meta/format-assertion" }
Expand Down
1 change: 1 addition & 0 deletions json/remotes/draft2020-12/metaschema-no-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
"https://json-schema.org/draft/2020-12/vocab/core": true
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/2020-12/meta/applicator" },
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"https://json-schema.org/draft/2020-12/vocab/core": true,
"http://localhost:1234/draft/2020-12/vocab/custom": false
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/2020-12/meta/validation" },
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" }
Expand Down
63 changes: 63 additions & 0 deletions json/test-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,69 @@
"type": "array",
"items": { "$ref": "#/$defs/test" },
"minItems": 1
},
"specification":{
"description": "A reference to a specification document which defines the behavior tested by this test case. Typically this should be a JSON Schema specification document, though in cases where the JSON Schema specification points to another RFC it should contain *both* the portion of the JSON Schema specification which indicates what RFC (and section) to follow as *well* as information on where in that specification the behavior is specified.",

"type": "array",
"minItems": 1,
"uniqueItems": true,
"items":{
"properties": {
"core": {
"description": "A section in official JSON Schema core drafts",
"url": "https://json-schema.org/specification-links",
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
"type":"string"
},
"validation": {
"description": "A section in official JSON Schema validation drafts",
"url": "https://json-schema.org/specification-links",
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
"type":"string"
},
"ecma262": {
"description": "A section in official ECMA 262 specification for defining regular expressions",
"url": "https://262.ecma-international.org/",
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
"type":"string"
},
"perl5": {
"description": "A section name in Perl documentation for defining regular expressions",
"url": "https://perldoc.perl.org/perlre",
"type":"string"
},
"quote": {
"description": "Quote describing the test case",
"type":"string"
}
},
"patternProperties": {
"^rfc\\d+$": {
"description": "A section in official RFC for the given rfc number",
"url": "https://www.rfc-editor.org/",
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
"type":"string"
},
"^iso\\d+$": {
"description": "A section in official ISO for the given iso number",
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
"type": "string"
}
},
"additionalProperties": { "type": "string" },
"minProperties": 1,
"propertyNames": {
"oneOf": [
{
"pattern": "^((iso)|(rfc))[0-9]+$"
},
{
"enum": [ "core", "validation", "ecma262", "perl5", "quote" ]
}
]
}
}
}
},
"additionalProperties": false
Expand Down
92 changes: 92 additions & 0 deletions json/tests/draft-next/additionalProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,97 @@
"valid": true
}
]
},
{
"description": "additionalProperties with propertyNames",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"propertyNames": {
"maxLength": 5
},
"additionalProperties": {
"type": "number"
}
},
"tests": [
{
"description": "Valid against both keywords",
"data": { "apple": 4 },
"valid": true
},
{
"description": "Valid against propertyNames, but not additionalProperties",
"data": { "fig": 2, "pear": "available" },
"valid": false
}
]
},
{
"description": "propertyDependencies with additionalProperties",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"properties" : {"foo2" : {}},
"propertyDependencies": {
"foo" : {},
"foo2": {
"bar": {
"properties": {
"buz": {}
}
}
}
},
"additionalProperties": false
},
"tests": [
{
"description": "additionalProperties doesn't consider propertyDependencies properties" ,
"data": {"foo": ""},
"valid": false
},
{
"description": "additionalProperties can't see buz even when foo2 is present",
"data": {"foo2": "bar", "buz": ""},
"valid": false
},
{
"description": "additionalProperties can't see buz",
"data": {"buz": ""},
"valid": false
}
]
},
{
"description": "dependentSchemas with additionalProperties",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"properties": {"foo2": {}},
"dependentSchemas": {
"foo": {},
"foo2": {
"properties": {
"bar": {}
}
}
},
"additionalProperties": false
},
"tests": [
{
"description": "additionalProperties doesn't consider dependentSchemas",
"data": {"foo": ""},
"valid": false
},
{
"description": "additionalProperties can't see bar",
"data": {"bar": ""},
"valid": false
},
{
"description": "additionalProperties can't see bar even when foo2 is present",
"data": {"foo2": "", "bar": ""},
"valid": false
}
]
}
]
24 changes: 0 additions & 24 deletions json/tests/draft-next/anchor.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,5 @@
"valid": false
}
]
},
{
"description": "invalid anchors",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$ref": "https://json-schema.org/draft/next/schema"
},
"tests": [
{
"description": "MUST start with a letter (and not #)",
"data": { "$anchor" : "#foo" },
"valid": false
},
{
"description": "JSON pointers are not valid",
"data": { "$anchor" : "/a/b" },
"valid": false
},
{
"description": "invalid with valid beginning",
"data": { "$anchor" : "foo#something" },
"valid": false
}
]
}
]
55 changes: 55 additions & 0 deletions json/tests/draft-next/dynamicRef.json
Original file line number Diff line number Diff line change
Expand Up @@ -642,5 +642,60 @@
"valid": false
}
]
},
{
"description": "$dynamicRef skips over intermediate resources - direct reference",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$id": "https://test.json-schema.org/dynamic-ref-skips-intermediate-resource/main",
"type": "object",
"properties": {
"bar-item": {
"$ref": "item"
}
},
"$defs": {
"bar": {
"$id": "bar",
"type": "array",
"items": {
"$ref": "item"
},
"$defs": {
"item": {
"$id": "item",
"type": "object",
"properties": {
"content": {
"$dynamicRef": "#content"
}
},
"$defs": {
"defaultContent": {
"$dynamicAnchor": "content",
"type": "integer"
}
}
},
"content": {
"$dynamicAnchor": "content",
"type": "string"
}
}
}
}
},
"tests": [
{
"description": "integer property passes",
"data": { "bar-item": { "content": 42 } },
"valid": true
},
{
"description": "string property fails",
"data": { "bar-item": { "content": "value" } },
"valid": false
}
]
}
]
Loading

0 comments on commit ebc90bb

Please sign in to comment.