JSON Schema 2020-12: Composition and Closed-Object Debugging

JSON Schema 2020-12: Composition and Closed-Object Debugging

Choose one answer. All questions are included, with explanations after checking. No time limit. Training target: 23/28. Diagnose object validation failures and accidental acceptance in JSON Schema Draft 2020-12: presence, overlapping alternatives, local and cross-branch closure, conditional guards, tagged variants and dialect support. Original schema and payload cases; not a full JSON Schema certification exam. Sources: https://json-schema.org/understanding-json-schema/reference/object https://json-schema.org/draft/2020-12/json-schema-core https://json-schema.org/draft/2020-12/json-schema-validation https://json-schema.org/understanding-json-schema/reference/conditionals https://python-jsonschema.readthedocs.io/en/stable/validate/
1 of 28
Use JSON Schema Draft 2020-12 with no data coercion or default insertion. An upload object activates a schema when compressed is present, even when its value is false. Which result follows? Schema:
JSON
{"type":"object","properties":{"compressed":{"type":"boolean"}},"dependentSchemas":{"compressed":{"required":["codec"],"properties":{"codec":{"enum":["gzip","zstd"]}}}},"unevaluatedProperties":false}
Instances: A = {"compressed":false}; B = {"compressed":false,"codec":"gzip"}.