how to validate based on value in Draft-04

21 views
Skip to first unread message

kkmt...@gmail.com

unread,
Dec 9, 2018, 11:06:48 AM12/9/18
to jsonschema - An implementation of JSON Schema for Python
Hi all,

How can i modify this schema so that whenever the type has been identified as debit card and required property fails for debit card then it should not proceed to check for credit card in oneof and return the error that name is required in debit card. I am using python which supports till draft-4.
{
"oneOf": [
{
"properties": {
"Type": {
"enum": [
"Debit"
]
},
"Option": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Address": {
"type": "string"
}
},
"required": [
"Name"
]
}
}
},
{
"properties": {
"Type": {
"enum": [
"credit card"
],
"Name": {
"type": "string"
},
"Age": {
"type": "number"
},
"Address": {
"type": "string"
}
}
},
"required": [
"Name",
"Address"
]
}
]
}
Reply all
Reply to author
Forward
0 new messages