Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(test-suite): incremental test suite update from upstream #177

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,45 @@
data:
foo: null
valid: true
- description: additionalProperties with propertyNames
schema:
$schema: https://json-schema.org/draft/2019-09/schema
propertyNames:
maxLength: 5
additionalProperties:
type: number
tests:
- description: Valid against both keywords
data:
apple: 4
valid: true
- description: Valid against propertyNames, but not unevaluatedProperties
data:
fig: 2
pear: available
valid: false
- description: dependentSchemas with additionalProperties
schema:
$schema: https://json-schema.org/draft/2019-09/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
Original file line number Diff line number Diff line change
Expand Up @@ -1078,3 +1078,28 @@
data:
bar: a
valid: false
- description: dependentSchemas with unevaluatedProperties
schema:
$schema: https://json-schema.org/draft/2019-09/schema
properties:
foo2: {}
dependentSchemas:
foo: {}
foo2:
properties:
bar: {}
unevaluatedProperties: false
tests:
- description: unevaluatedProperties doesn't consider dependentSchemas
data:
foo: ""
valid: false
- description: unevaluatedProperties doesn't see bar when foo2 is absent
data:
bar: ""
valid: false
- description: unevaluatedProperties sees bar when foo2 is present
data:
foo2: ""
bar: ""
valid: true
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,45 @@
data:
foo: null
valid: true
- description: additionalProperties with propertyNames
schema:
$schema: https://json-schema.org/draft/2020-12/schema
propertyNames:
maxLength: 5
additionalProperties:
type: number
tests:
- description: Valid against both keywords
data:
apple: 4
valid: true
- description: Valid against propertyNames, but not unevaluatedProperties
data:
fig: 2
pear: available
valid: false
- description: dependentSchemas with additionalProperties
schema:
$schema: https://json-schema.org/draft/2020-12/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
39 changes: 39 additions & 0 deletions src/test/resources/suite-yaml/tests/draft2020-12/dynamicRef.yml
Original file line number Diff line number Diff line change
Expand Up @@ -536,3 +536,42 @@
data:
"false": 1
valid: false
- description: $dynamicRef skips over intermediate resources - direct reference
schema:
$schema: https://json-schema.org/draft/2020-12/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
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
- description: $dynamicRef skips over intermediate resources - pointer reference across resource boundary
schema:
$schema: https://json-schema.org/draft/2020-12/schema
$id: https://test.json-schema.org/dynamic-ref-skips-intermediate-resource/optional/main
type: object
properties:
bar-item:
$ref: bar#/$defs/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
Original file line number Diff line number Diff line change
Expand Up @@ -1075,3 +1075,28 @@
data:
bar: a
valid: false
- description: dependentSchemas with unevaluatedProperties
schema:
$schema: https://json-schema.org/draft/2020-12/schema
properties:
foo2: {}
dependentSchemas:
foo: {}
foo2:
properties:
bar: {}
unevaluatedProperties: false
tests:
- description: unevaluatedProperties doesn't consider dependentSchemas
data:
foo: ""
valid: false
- description: unevaluatedProperties doesn't see bar when foo2 is absent
data:
bar: ""
valid: false
- description: unevaluatedProperties sees bar when foo2 is present
data:
foo2: ""
bar: ""
valid: true
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,62 @@
"valid": true
}
]
},
{
"description": "additionalProperties with propertyNames",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"propertyNames": {
"maxLength": 5
},
"additionalProperties": {
"type": "number"
}
},
"tests": [
{
"description": "Valid against both keywords",
"data": { "apple": 4 },
"valid": true
},
{
"description": "Valid against propertyNames, but not unevaluatedProperties",
"data": { "fig": 2, "pear": "available" },
"valid": false
}
]
},
{
"description": "dependentSchemas with additionalProperties",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/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
}
]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -1567,5 +1567,38 @@
"valid": false
}
]
},
{
"description": "dependentSchemas with unevaluatedProperties",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"properties": {"foo2": {}},
"dependentSchemas": {
"foo" : {},
"foo2": {
"properties": {
"bar":{}
}
}
},
"unevaluatedProperties": false
},
"tests": [
{
"description": "unevaluatedProperties doesn't consider dependentSchemas",
"data": {"foo": ""},
"valid": false
},
{
"description": "unevaluatedProperties doesn't see bar when foo2 is absent",
"data": {"bar": ""},
"valid": false
},
{
"description": "unevaluatedProperties sees bar when foo2 is present",
"data": { "foo2": "", "bar": ""},
"valid": true
}
]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,62 @@
"valid": true
}
]
},
{
"description": "additionalProperties with propertyNames",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"propertyNames": {
"maxLength": 5
},
"additionalProperties": {
"type": "number"
}
},
"tests": [
{
"description": "Valid against both keywords",
"data": { "apple": 4 },
"valid": true
},
{
"description": "Valid against propertyNames, but not unevaluatedProperties",
"data": { "fig": 2, "pear": "available" },
"valid": false
}
]
},
{
"description": "dependentSchemas with additionalProperties",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/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
}
]
}
]
Loading
Loading