Replies: 1 comment
-
Hi @bachikawa, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My API has a default validation error that is overridden by my own definition. It is defined in a way using
@api.exception_handler
based on the official documentation and returns an error response byapi.create_response()
.For a normal response (status 200), I know that the response content is validated by using
response={200: MyResponseSchema}
.But how can I validate the default validation error as well as the normal response?
I put
response={200: MyResponseSchema, 400: MyValidationErrorSchema}
in my code.In my opinion, the auto-generated openapi may not match the actual API specification, since validation errors are not handled in the View.
My desire is to have the auto-generated openapi and the error response returned by the API match exactly at the code level. I believe this will ensure accurate documentation.
I am a native Japanese speaker, so I am using the power of a translator. Thanks for reading.
Beta Was this translation helpful? Give feedback.
All reactions