I find it very hard to work with the error message from Ajv
when using not
in my schema. In my use case, I want to validate two props not being of the same value. Consider this example:
schema.json
{
"$schema": "http://json-schema.org/draft-06/schema",
"properties": {
"propA": {
"type": "string"
},
"propB": {
"type": "string",
"not": {
"const": {
"$data": "1/propA"
}
}
}
}
}
data
{ propA: 'foo', propB: 'foo' }
output
[ { keyword: 'not',
dataPath: '.propB',
schemaPath: '#/properties/propB/not',
params: {},
message: 'should NOT be valid' } ]
The error message tells me that not
is rejected, but the really relevant information would be that const
was not satisfied.
Does anyone have a hint or workaround how I can get a meaningful error message for this use case?