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

Tests for propertyNames with additionalProperties/unevaluatedProperties #733

Merged
merged 8 commits into from
Apr 14, 2024
24 changes: 24 additions & 0 deletions tests/draft-next/additionalProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,29 @@
"valid": true
}
]
},
{
"description": "additionalProperties with propertyNames",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"propertyNames": {
"maxLength": 5
},
"additionalProperties":{
suprith-hub marked this conversation as resolved.
Show resolved Hide resolved
"type": "number"
}
},
"tests": [
{
"description": "Valid against both keywords",
"data": {"apple": 4},
suprith-hub marked this conversation as resolved.
Show resolved Hide resolved
"valid": true
},
{
"description": "Valid against propertyNames, but not unevaluatedProperties",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this says unevaluatedProperties, should say additionalProperties I think.
same for the other two.

Copy link
Contributor Author

@suprith-hub suprith-hub Apr 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah! let me just correct it and raise the pull request again.
I will have to be more careful... Thank you

"data": { "fig": 2, "pear": "available" },
"valid": false
}
]
}
]
24 changes: 24 additions & 0 deletions tests/draft2019-09/additionalProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,29 @@
"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 unevaluatedProperties",
"data": { "fig": 2, "pear": "available" },
"valid": false
}
]
}
]
24 changes: 24 additions & 0 deletions tests/draft2020-12/additionalProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,29 @@
"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
}
]
}
]
2 changes: 1 addition & 1 deletion tests/draft2020-12/propertyNames.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@
}
]
}
]
]
suprith-hub marked this conversation as resolved.
Show resolved Hide resolved
Loading