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

Unify HTTP 400 responses #1595

Open
fridex opened this issue Jan 11, 2022 · 4 comments
Open

Unify HTTP 400 responses #1595

fridex opened this issue Jan 11, 2022 · 4 comments
Labels
area/user-api Issues or PRs related to the User API good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/user-experience Issues or PRs related to the User Experience of our Services, Tools, and Libraries. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@fridex
Copy link
Contributor

fridex commented Jan 11, 2022

Describe the bug

User API responds with 400 HTTP status codes for invalid requests. These requests can be invalid on multiple layers though. They can be invalid based on checks that are done in implemented endpoint handlers but also based on schema validation. The schema validation issue reports are handled by connexion and differ from the ones that are implemented by us in the Python code. They do not conform to HTTP 400 schema that is declared on Python endpoints.

To Reproduce
Steps to reproduce the behavior:

  1. As an example, use a CLI tool to interact with API and ask for results on an endpoint but do not provide required input:
curl -X 'GET' \
  'http://stage.thoth-station.ninja/api/v1/python/package/version/metadata?name=flask&version=0.12&index=https%3A%2F%2Fpypi.org%2Fsimple&os_version=8&python_version=3.8' \
  -H 'accept: application/json'
{
  "detail": "Missing query parameter 'os_name'",
  "status": 400,
  "title": "Bad Request",
  "type": "about:blank"
}
  1. See the response is not conforming to the OpenAPI spec

Expected behavior

The response should be conforming to the OpenAPI spec.

Additional context

I've tried to register a custom flask for 400 or providing a custom connexion validator. None of these worked though - I did not invest much time into this, but it might be nice to have.

@fridex fridex added kind/bug Categorizes issue or PR as related to a bug. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. area/user-api Issues or PRs related to the User API sig/user-experience Issues or PRs related to the User Experience of our Services, Tools, and Libraries. labels Jan 11, 2022
@goern
Copy link
Member

goern commented Jan 14, 2022

/priority important-soon
/triage accepted

@sesheta sesheta added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Jan 14, 2022
@sesheta
Copy link
Member

sesheta commented Apr 14, 2022

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@sesheta sesheta added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 14, 2022
@harshad16
Copy link
Member

/lifecycle frozen

@sesheta sesheta added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 18, 2022
@harshad16
Copy link
Member

seems like: #1766

@codificat codificat moved this to 📋 Backlog in Planning Board Sep 24, 2022
@goern goern added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. labels Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/user-api Issues or PRs related to the User API good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/user-experience Issues or PRs related to the User Experience of our Services, Tools, and Libraries. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: 📋 Backlog
Development

No branches or pull requests

5 participants