Skip to content

Commit

Permalink
Squashed 'json/' changes from b41167c74..54f3784a8
Browse files Browse the repository at this point in the history
54f3784a8 Merge pull request #731 from MeastroZI/main
ff29264c2 Merge pull request #741 from harrel56/chore/tabs-to-spaces
9f39cf731 use spaces instead of tabs
2f3b5f7ab Corrected replaced unevaluated with additoinalProperties
fa9224d7e Merge pull request #732 from MeastroZI/main2
83bedd5c8 Changing descriptions
49f73429c fixing tests
e6d6a0816 adding more test cases
7e6c9be6d changing descriptions
959aca926 shifting test
605d7d786 Update propertyDependencies.json : test must be tests
deb82824b test for dependentSchema and propertyDependencies with unevaluatedProperties and additionalProperties
ea4851242 Merge branch 'json-schema-org:main' into main
64a3e7b37 Merge pull request #721 from json-schema-org/gregsdennis/dynamicref-skips-resources
b9f14e64c Fix $schema in new new test
3d5048e83 Merge pull request #733 from Era-cell/main
2480edbae Update additionalProperties.json formatting it
6aa79c0b2 Update additionalProperties.json formatting it
3e0139a54 Update tests/draft-next/additionalProperties.json
616240b06 Update tests/draft-next/additionalProperties.json
c5f3e4eaa Update tests/draft2020-12/propertyNames.json
964efb8e6 propertyNames doesn't affect additionalProperties, tests exist already for unevaluatedProps
f08b884cf Cases go under additional and unevaluated Properties
99864ff66 added tests for propertyNames with additionalProperties/unevaluatedProperties, also with specification property
3b5782b65 Update ref.json : changing $Ids
546b3561a test for $ref with $recursiveAnchor
57617f254 Merge pull request #726 from Era-cell/main
51fc69cd7 meta data and property names constraints added, additional Items: string
9b169bed8 specification takes array of objects having section and quote
1362a8cce Pattern for para corrected
340116ecf Schema of specification in much structured
003ac0211 Test-schema including sub-schema for scpecification
50a20280b adding specification enhancement for additionalProperties
604f5f99b Drop tests of `$id` and `$anchor` that just test values against meta-schema `pattern` for those properties
9cd64ec94 come on man, save all the files
f494440e3 use unique $id in optional tests, too
468453b0f use unique $id
9ec6d17e7 fix copy/paste error
b284f4232 add tests for $dynamicRef skipping over resources
bf0360f4b add $recursiveAnchor to 2019-09 meta-schemas
0519d1f0e add $dynamicAnchor to meta-schemas

git-subtree-dir: json
git-subtree-split: 54f3784a8c6926d8e91ed43267950a07efc34086
  • Loading branch information
Julian committed Apr 30, 2024
1 parent 00e21eb commit 8fcfc3a
Show file tree
Hide file tree
Showing 36 changed files with 689 additions and 747 deletions.
1 change: 1 addition & 0 deletions 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 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 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
1 change: 1 addition & 0 deletions remotes/draft-next/metaschema-optional-vocabulary.json
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 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
1 change: 1 addition & 0 deletions remotes/draft2019-09/metaschema-optional-vocabulary.json
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 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 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 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
1 change: 1 addition & 0 deletions remotes/draft2020-12/metaschema-optional-vocabulary.json
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 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 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 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 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
}
]
}
]

0 comments on commit 8fcfc3a

Please sign in to comment.