1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-30977: Additional key values are not validating properly when using

unevaluatedProperties with properties declared in subschemas

Analysis:
When a key fails to validate for "properties" when "properties" is being
treated as alternate schema, it needs to fall back on alternate schema
for "properites" itself ("unevaluatedProperties" in context of the bug).
But that doesn't happen and we end up returning false (=validated)
Fix:
When "properties" fails to validate as an alternate schema, fall back on
alternate schema for "properties" itself.
This commit is contained in:
Rucha Deodhar
2023-04-04 14:39:41 +05:30
parent ee41fa38fc
commit 1c25b5c026
3 changed files with 52 additions and 0 deletions

View File

@ -3398,6 +3398,27 @@ SET @schema_required='{"type":"object","required":[1,"str1", "str1"]}';
--error ER_JSON_INVALID_VALUE_FOR_KEYWORD
SELECT JSON_SCHEMA_VALID(@schema_required,'{"num1":1, "str1":"abc", "arr1":[1,2,3]}');
--echo #
--echo # MDEV-30977: Additional key values are not validating properly when using
--echo # unevaluatedProperties with properties declared in subschemas
--echo #
SET @unevaluatedProperties_schema= '{
"allOf": [
{
"type": "object",
"properties": {
"name": { "type": "string" }
}
}
],
"properties": {
"type": { "enum": ["residential", "business"] }
},
"required": ["type"],
"unevaluatedProperties": false
}';
SELECT JSON_SCHEMA_VALID(@unevaluatedProperties_schema, '{"name": "joe", "type": "business", "dummy" : "hello" }');
--echo #
--echo # MDEV-30995: JSON_SCHEMA_VALID is not validating case sensitive when using regex