We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello everybody,
I have problem in my json schema, I try to validate the content of array based on enum value.
Here my json schema: `
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "motif": { "type": "object", "properties": { "subMotif": { "enum": [ "mtf1", "mtf2", "mtf3" ] } }, "required": [ "subMotif" ] }, "additionalData": { "type": "array", "items": [ { "type": "object", "properties": { "cle": { "type": "string" }, "valeur": { "type": "string" } }, "required": [ "cle", "valeur" ] } ] } }, "anyOf": [ { "if": { "properties": { "#/motif/subMotif": { "const": "mtf1" } } }, "then": { "properties": { "additionalData": { "contains": { "properties": { "cle": { "const": "key1" }, "valeur": { "minLength": 2 } }, "properties": { "cle": { "const": "key2" }, "valeur": { "minLength": 3 } } } } } } }, { "if": { "properties": { "#/motif/subMotif": { "const": "mtf2" } } }, "then": { "properties": { "additionalData": { "contains": { "properties": { "cle": { "const": "anotherKeyxx" }, "valeur": { "pattern": "" } }, "properties": { "cle": { "const": "anotherKeyyy" }, "valeur": { "pattern": "" } } } } } } } ], "required": [ "motif" ] }
`
this json it should be valid:
{ "motif": { "subMotif": "mtf1" }, "additionalData": [ { "cle": "key1", "valeur": "valeur1" }, { "cle": "key2", "valeur": "aaa" } ] }
`,
{ "motif": { "subMotif": "mtf2" }, "additionalData": [ { "cle": "anotherKeyxx", "valeur": "valeur1" }, { "cle": "anotherKeyyy", "valeur": "val" } ] }
` This json is not valid:
{ "motif": { "subMotif": "mtf1" }, "additionalData": [ { "cle": "anotherKeyxx", "valeur": "valeur1" }, { "cle": "key2", "valeur": "valeur2" } ] }
I need help to fix the schema.
Best regards
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello everybody,
I have problem in my json schema,
I try to validate the content of array based on enum value.
Here my json schema:
`
`
this json it should be valid:
`
{
"motif": {
"subMotif": "mtf1"
},
"additionalData": [
{
"cle": "key1",
"valeur": "valeur1"
},
{
"cle": "key2",
"valeur": "aaa"
}
]
}
`,
`
{
"motif": {
"subMotif": "mtf2"
},
"additionalData": [
{
"cle": "anotherKeyxx",
"valeur": "valeur1"
},
{
"cle": "anotherKeyyy",
"valeur": "val"
}
]
}
`
This json is not valid:
`
`
I need help to fix the schema.
Best regards
The text was updated successfully, but these errors were encountered: