Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.4, 11.8, 12.3
Description
Hi,
I found JSON_SCHEMA_VALID returns an incorrect result for objects validated through additionalProperties or unevaluatedProperties, compared with an equivalent explicit schema.
This test case can reproduce this:
SET @obj_value = '{"outer":{"x":"ok"}}'; |
SET @obj_schema_ref = '{"type":"object","properties":{"outer":{"type":"object","properties":{"x":{"type":"string"}},"required":["x"]}},"required":["outer"]}'; |
SET @schema_additional = '{"type":"object","additionalProperties":{"type":"object","properties":{"x":{"type":"string"}},"required":["x"]}}'; |
SET @schema_uneval_props = '{"type":"object","unevaluatedProperties":{"type":"object","properties":{"x":{"type":"string"}},"required":["x"]}}'; |
|
|
SELECT JSON_SCHEMA_VALID(@schema_additional, @obj_value) AS observed, |
JSON_SCHEMA_VALID(@obj_schema_ref, @obj_value) AS reference_result; -- 0, 1 |
|
|
SELECT JSON_SCHEMA_VALID(@schema_uneval_props, @obj_value) AS observed, |
JSON_SCHEMA_VALID(@obj_schema_ref, @obj_value) AS reference_result; -- 0, 1 |
I can reproduce this with the commit version f6e44c1b7819f9befa3824f07866822288231528 of MariaDB server on github repo.