You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 by api.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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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