File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,13 @@ You can resolve JSON Schema references by passing registry
17
17
],
18
18
" properties" : {
19
19
" name" : {
20
- " $ref" : " #/components/schemas/Name "
20
+ " $ref" : " urn:name-schema "
21
21
},
22
22
" age" : {
23
- " $ref" : " #/components/schemas/Age "
23
+ " $ref" : " urn:age-schema "
24
24
},
25
25
" birth-date" : {
26
- " $ref" : " #/components/schemas/BirthDate "
26
+ " $ref" : " urn:birth-date-schema "
27
27
}
28
28
},
29
29
" additionalProperties" : False ,
@@ -54,6 +54,14 @@ You can resolve JSON Schema references by passing registry
54
54
],
55
55
)
56
56
57
+ # If no exception is raised by validate(), the instance is valid.
57
58
validate({" name" : " John" , " age" : 23 }, schema, registry = registry)
58
59
60
+ # raises error
61
+ validate({" birth-date" : " yesterday" , " age" : - 1 }, schema, registry = registry)
62
+
63
+ Traceback (most recent call last):
64
+ ...
65
+ ValidationError: ' name' is a required property
66
+
59
67
For more information about resolving references see `JSON (Schema) Referencing <https://python-jsonschema.readthedocs.io/en/latest/referencing/ >`__
You can’t perform that action at this time.
0 commit comments