-
-
Notifications
You must be signed in to change notification settings - Fork 610
Closed
Description
I am trying to figure out whether jsonschema supporting verifying optional field in json or not. I tried the following code:
from jsonschema import validate
# your code here
schema = {
"type" : "object",
"properties" : {
"price" : {"type" : "number", "required": false},
"name" : {"type" : "string"},
},
}
validate({"name" : "Eggs", "price" : 123.123}, schema)
I have this error:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-6-6a64e78dd26e> in <module>
5 "type" : "object",
6 "properties" : {
----> 7 "price" : {"type" : "number", "required": false},
8 "name" : {"type" : "string"},
9 },
NameError: name 'false' is not defined
So this feature isn't supported yet?
I found related question here
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels