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

Add errors fast api #18093

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open

Conversation

arash77
Copy link
Contributor

@arash77 arash77 commented May 3, 2024

What did you do?

  • Remove 422 Validation error response
  • Add 400 Bad request error response
  • Create MessageExceptionModel and ValidationErrorModel for the schema of error responses

Why did you make this change?

The Validation error should be replaced by the Bad request error as it is not the real model that is returning.

How to test the changes?

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@github-actions github-actions bot added this to the 24.1 milestone May 3, 2024
Comment on lines +13143 to 13151
/** @description Bad Request */
400: {
content: {
"application/json": components["schemas"]["MessageExceptionModel"];
};
};
/** @description Validation Error */
422: {
content: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the 422 is still getting generated in the resulting schema so remove_422 doesn't seem to work as expected. We could keep the 422 as a validation-specific error though given the response data is in the format we want and adapt the client error handling to support it. What do others think about this?

Have a look at https://fastapi.tiangolo.com/tutorial/handling-errors/#override-request-validation-exceptions and this discussion tiangolo/fastapi#9061 if you haven't already, maybe there is an interesting solution there.

@mvdbeek mvdbeek modified the milestones: 24.1, 24.2 May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants