FAST API
Type declarations
FastAPI uses the same declarations to:
Define requirements: from request path parameters, query parameters, headers, bodies, dependencies, etc.
Convert data: from the request to the required type.
- Validate data
coming from each request:
- Generating automatic errors returned to the client when the data is invalid.
Document
the API using OpenAPI:
- which is then used by the automatic interactive documentation user interfaces.
Routing
- path operation function
- async def but for sqlalchemy it should be def
- Starlette (and FastAPI) are based on AnyIO , which makes it compatible with both Python’s standard library asyncio and Trio .
SQL ALchemy
- we should define both sqlalchemy models (extening
Base = declarative_base()) - for each model we should add a pydantic model for request / response validation