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
1717 ],
1818 " properties" : {
1919 " name" : {
20- " $ref" : " #/components/schemas/Name "
20+ " $ref" : " urn:name-schema "
2121 },
2222 " age" : {
23- " $ref" : " #/components/schemas/Age "
23+ " $ref" : " urn:age-schema "
2424 },
2525 " birth-date" : {
26- " $ref" : " #/components/schemas/BirthDate "
26+ " $ref" : " urn:birth-date-schema "
2727 }
2828 },
2929 " additionalProperties" : False ,
@@ -54,6 +54,14 @@ You can resolve JSON Schema references by passing registry
5454 ],
5555 )
5656
57+ # If no exception is raised by validate(), the instance is valid.
5758 validate({" name" : " John" , " age" : 23 }, schema, registry = registry)
5859
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+
5967 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