Error location for mandatory property

38 views
Skip to first unread message

Buddi1704

unread,
Mar 27, 2020, 7:30:05 AM3/27/20
to jsonschema - An implementation of JSON Schema for Python
Hey,

here is my code:

data1 = {
"environ_impact" : 10
}

schema1 = {
"type": "object",
"required": [
"environ_impact",
"bla"
],
"properties": {
"environ_impact": {
"type": "number"
},

"bla": {
"type": "number"
}
}
}

Clearly the property "bla" is missing in the schema, and I want to know that bla is missing.
I am looking for an error message which just returns me "bla", or the path to bla + "bla", if bla would be nested.
Error.validator just returns me the whole list of required properties which isn't that useful imo.
Error.message has this information, so why isnt it returned in its own error message? For me right now stripping this information out of error message seems like the only possible workaround

Thanks for your help!
Reply all
Reply to author
Forward
0 new messages