Hi,
When using the oapi.OapiRequestValidatorWithOptions is there a way to get a more detailed error?
When I have a parameter which is an enum and the value passed is not in the enum would be great to know the field failing the validation.
Instead I get a huge message about the whole schema:
{"error": "code=400, message=Request body has an error: doesn't match the schema: Doesn't match schema \"oneOf\", internal=Request body has an error: doesn't match the schema: Doesn't match schema \"oneOf\"\nSchema:\n {\n \"description\": \"Details of an event.\",\n \"oneOf\": [\n {\n \"$ref\": \"#/components/schemas/Deployment\"\n },\n {\n \"$ref\": \"#/components/schemas/Change\"\n },\n {\n \"$ref\": \"#/components/schemas/Incident\"\n }\n ],\n \"type\": \"object\"\n }\n\nValue:\n {\n \"$type\": \"incidenta\",\n \"incident_id\": \"1627554151\",\n \"source\": \"api\",\n \"time_created\": \"2021-07-29T09:10:00Z\",\n \"time_resolved\": \"2021-07-29T09:10:00Z\"\n }\n"}
In this case only the field $type is wrong not the whole object.
Also would be even better if we could let people know what are the valid options.
Any idea if any of this is possible or if this could even be implemented? I would be up to help if some pointers are provided.
Hi,
When using the
oapi.OapiRequestValidatorWithOptionsis there a way to get a more detailed error?When I have a parameter which is an enum and the value passed is not in the enum would be great to know the field failing the validation.
Instead I get a huge message about the whole schema:
In this case only the field
$typeis wrong not the whole object.Also would be even better if we could let people know what are the valid options.
Any idea if any of this is possible or if this could even be implemented? I would be up to help if some pointers are provided.