Skip to content

Commit 685e34c

Browse files
committed
Look for subschemas in definitions, even in newer dialects.
Even though `definitions` was renamed to `$defs`, the JSON Schema specifications still use SHOULD language when describing preserving behavior for `definitions`. Specifically they say: implementations SHOULD assume that "$defs" and "definitions" have the same behavior when that meta-schema is used. from https://json-schema.org/draft/2020-12/json-schema-validation#name-keywords-moved-from-validat Closes: #129
1 parent 55a1ccf commit 685e34c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

docs/changes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
Changelog
33
=========
44

5+
v0.34.0
6+
-------
7+
8+
* Also look inside ``definitions`` keywords even on newer dialects.
9+
The specification recommends doing so regardless of the rename to ``$defs``.
10+
511
v0.33.0
612
-------
713

referencing/jsonschema.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ def maybe_in_subresource(
377377
in_subarray={"allOf", "anyOf", "oneOf", "prefixItems"},
378378
in_subvalues={
379379
"$defs",
380+
"definitions",
380381
"dependentSchemas",
381382
"patternProperties",
382383
"properties",
@@ -400,6 +401,7 @@ def maybe_in_subresource(
400401
in_subarray={"allOf", "anyOf", "oneOf", "prefixItems"},
401402
in_subvalues={
402403
"$defs",
404+
"definitions",
403405
"dependentSchemas",
404406
"patternProperties",
405407
"properties",
@@ -427,6 +429,7 @@ def maybe_in_subresource(
427429
in_subarray={"allOf", "anyOf", "oneOf"},
428430
in_subvalues={
429431
"$defs",
432+
"definitions",
430433
"dependentSchemas",
431434
"patternProperties",
432435
"properties",
@@ -450,6 +453,7 @@ def maybe_in_subresource(
450453
in_subarray={"allOf", "anyOf", "oneOf"},
451454
in_subvalues={
452455
"$defs",
456+
"definitions",
453457
"dependentSchemas",
454458
"patternProperties",
455459
"properties",

0 commit comments

Comments
 (0)