-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
python_examples: Validate error responses. #30418
Conversation
@laurynmm can you review this? |
5799756
to
541abdb
Compare
In what way is that validation not correct? It's not obvious to me why the remedy should be to remove that vs., for example, checking both. |
As explained here, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Vector73 - Thanks for doing this follow-up! I had one small comment on the function name.
It might be good to add a TODO
comment somewhere (maybe above this new function) about wanting to add back the validate_against_openapi_schema
when that is updated to actually validate our error responses in the documentation.
Even if we don't delete those validate_against_openapi_schema
checks for these error responses, I think adding this new check for the expected error code is useful. The schema check wouldn't confirm that anyway.
I think it's better to keep the |
My one concern is that it then looks like these documented error responses are being validated as part of this test, when we're really just skipping any validation for 4xx responses. |
My view is we should probably open an issue to track removing #30115 (comment), rather than removing infrastructure in other places; that seems like the simpler path to having complete validation down the line. |
Okay. Makes sense. @Vector73 - For this PR, the consensus is to not remove We most recently talked about documenting error responses on CZO here: https://chat.zulip.org/#narrow/stream/412-api-documentation/topic/documenting.20error.20responses/near/1644535. It's a bit more complicated than the code comment in |
541abdb
to
9873c83
Compare
@laurynmm I have updated this PR. |
Adds assert statements to validate error response for "400" error code. The current validation using `validate_against_openapi_schema` doesn't work for "400" responses. Adds separate functions to validate "200" and "400" responses and removes `validate_response_result`.
9873c83
to
b85bdb2
Compare
Looks great, merged, thanks @Vector73! |
This PR is a follow-up of #30115. It adds assert statements to validate the error response for the "400" error code. The current validation using
validate_against_openapi_schema
doesn't correctly validate "400" responses.Fixes:
Screenshots and screen captures:
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: