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

"Hello" API: the server response is different from the one expected #118

Closed
aleene opened this issue Nov 6, 2022 · 6 comments · Fixed by #238
Closed

"Hello" API: the server response is different from the one expected #118

aleene opened this issue Nov 6, 2022 · 6 comments · Fixed by #238

Comments

@aleene
Copy link

aleene commented Nov 6, 2022

What

The Swagger documentation specifies 2 200 responses for the Hello API. Which one is the correct one?

Steps to reproduce the behavior:

Look at the Swagger doc

Expected behaviour

Just the json response seems enough.

Part of

@aleene aleene added the 🐛 bug Something isn't working label Nov 6, 2022
@teolemon teolemon changed the title Hello API The Swagger documentation specifies 2 "200 responses" for the Hello API Nov 29, 2022
@CharlesNepote
Copy link
Member

What do you mean?

https://api.folksonomy.openfoodfacts.org/docs#/default/hello__get provides only one answer.

@aleene
Copy link
Author

aleene commented Nov 30, 2022

image

@alexgarel
Copy link
Member

@CharlesNepote it's more than the documentation is not accurate.
The part you above is because the real answer. While the schema at the bottom specify we should receive a simple string, while indeed we receive a dict with a "message" key containing the message.

@CharlesNepote
Copy link
Member

Ok. So the title of this issue is wrong. We don't get 2 "200" answers: you can verify with curl -v -X 'GET' 'https://api.folksonomy.openfoodfacts.org/' -H 'accept: application/json'.

The second "200" shown on your screenshot is what the API should reply.

So there is indeed an issue, but the right title should be "The server response is different from the one expected". I'm changing the title.

@CharlesNepote CharlesNepote changed the title The Swagger documentation specifies 2 "200 responses" for the Hello API "Hello" API: the server response is different from the one expected Sep 19, 2023
@CharlesNepote
Copy link
Member

The issue occurs with:

  • [GET] /
  • [POST] /auth
  • [POST] /auth_by_cookie
  • [DELETE] /product/{product}/{k}]
  • [PUT] /product
  • [POST] /product
  • [GET] /keys
  • [GET/ ping

I guess we need to create more classes in https://github.com/openfoodfacts/folksonomy_api/blob/main/folksonomy/models.py and add them to the routes as in
@app.get("/products/stats", response_model=List[ProductStats])

@teolemon teolemon removed the 🐛 bug Something isn't working label Dec 6, 2024
@suchithh
Copy link
Contributor

Working on this. Essentially boils down to creating BaseModels and assigning it as response model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
5 participants