summaryrefslogtreecommitdiff
path: root/mysql-test/main/func_json.test
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2023-04-04 14:39:41 +0530
committerRucha Deodhar <rucha.deodhar@mariadb.com>2023-04-26 11:00:08 +0530
commit1c25b5c02666420eba5708bb93a6a41e7d7a3a63 (patch)
treec4b3f7774ca8727b081f49924a8ad68fe430a567 /mysql-test/main/func_json.test
parentee41fa38fc3b393e0e7b73bed098274248b8492d (diff)
downloadmariadb-git-1c25b5c02666420eba5708bb93a6a41e7d7a3a63.tar.gz
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.
Diffstat (limited to 'mysql-test/main/func_json.test')
-rw-r--r--mysql-test/main/func_json.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test
index 5517dcfa6c8..4a400f1de90 100644
--- a/mysql-test/main/func_json.test
+++ b/mysql-test/main/func_json.test
@@ -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