Open NaveenGurram opened 5 years ago
Hello @NaveenGurram , can you please confirm that this issue is about requesting a change of the exception message of const
violations? Also, any suggestions on the exception message you would like to see?
@erosb yes this is requesting a change for the "const" violation exception message. I didn't think of what the message should look like, let me think about it and comment.
If possible instead of this at the oneOf level.
"keyword": "oneOf",
"message": "#: 0 subschemas matched instead of one"
can we have something like
"keyword": "oneOf",
"message": "#: has to be oneOf ['AL','AK']"
if not some message at the each oneOf violation
{
"schemaLocation": "#/properties/state/oneOf/0",
"pointerToViolation": "#/state",
"causingExceptions": [],
"keyword": "const",
"message": "NEW MESSAGE HERE"
}
Just for curiosity, why don't you use an enum schema instead of a oneOf with 2 const subschemas?
On Thu, 18 Apr 2019, 14:48 Naveen Kumar Gurram, notifications@github.com wrote:
If possible instead of this at the oneOf level.
"keyword": "oneOf", "message": "#: 0 subschemas matched instead of one"
can we have something like
"keyword": "oneOf", "message": "#: has to be oneOf ['AL','AK']"
if not some message at the each oneOf violation
{ "schemaLocation": "#/properties/state/oneOf/0", "pointerToViolation": "#/state", "causingExceptions": [], "keyword": "const", "message": "NEW MESSAGE HERE" }
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/everit-org/json-schema/issues/294#issuecomment-484492455, or mute the thread https://github.com/notifications/unsubscribe-auth/AACCWBVBVPLIZ6EKG7W7BKLPRBU3JANCNFSM4HFGYHJQ .
yes, but we are using this schema to generate form and display value is different from the code, so only option is use this construct and this is sample we have list of all 52 US states.
Hi,
When there is an exception for oneOf schemas message is empty, it is possible to put some message here.
Json Schema
Input
and in exception, for oneOf sub schemas, message is empty for eg: schemaLocation "#/properties/state/oneOf/0" message is empty, is it possible to put some message here, because of this null i had to get the violatedSchema and look at the allowedValue to formulate a meaningful message.
Exception