aiondemand / AIOD-rest-api

Services for the core of AIoD: Authentication and the metadata catalogue with REST API.
https://api.aiod.eu
MIT License
10 stars 7 forks source link

Make user of FastAPI `Annotate` instead of default parameters #217

Closed josvandervelde closed 9 months ago

josvandervelde commented 9 months ago

In a recent PR I changed functions such as limit: Annotated[int | None, Query(ge=1, le=LIMIT_MAX)] = 10, towards limit: int = Query(ge=1, le=LIMIT_MAX, default=10),

But, this is not a best practices, as Jean Matias pointed out. FastAPI suggests we use Annotated: https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#advantages-of-annotated.

So, let's rewrite all = Query and = Path to their Annotated variant.

PGijsbers commented 9 months ago

Can you assign me? I will take up this issue next week as its scope is excellent for me to get a little more acquainted with the project development flow and project structure.