openfoodfacts / folksonomy_api

A light REST API designed for Open Food Facts folksonomy engine
https://wiki.openfoodfacts.org/Folksonomy_Engine
GNU Affero General Public License v3.0
11 stars 7 forks source link

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

Open aleene opened 2 years ago

aleene commented 2 years ago

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

CharlesNepote commented 2 years ago

What do you mean?

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

aleene commented 2 years ago

image

alexgarel commented 2 years ago

@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 commented 1 year ago

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 commented 1 year ago

The issue occurs with:

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])