Skip to content
New issue

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

Handling multi-error summaries (returned when using oneOf for example) #1

Closed
wants to merge 1 commit into from

Conversation

chrusty
Copy link
Owner

@chrusty chrusty commented Jul 18, 2022

The validation error response coming from the getkin/kin-openapi does contain a useful summary on the first line, but under some circumstances this multi-line string error (obviously not the easiest thing to work with) can contain descriptions of other possible errors.

One such circumstance is when using "oneOf" to validate request bodies. In the scenario where a payload fails to validate against either of the oneOf schemas, the validation middleware simply returns the first description. It is however apparent that they appear in random order, which leads to an inconsistent (and often incorrect) validation response.

This PR shows how we can make this experience slightly more accurate.

@chrusty chrusty closed this Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant