FastAPI flash cards: Apprentice level

13 FastAPI terms at the Apprentice level, as flash cards.

Updated

Terms in this deck

async def
Declares an endpoint that can `await` slow work without blocking the server.
Automatic Validation
Bad input is rejected with a clear 422 error before your code runs.
BaseModel
The Pydantic base class for data models.
EmailStr
Pydantic's type for an email address: text that must have the shape of one, an @ and a domain after it, though it can't tell whether the mailbox exists.
HTTPException
Raised to send an error response with a status code and message.
OpenAPI
The standard API description FastAPI generates at `/openapi.json`.
Path Parameter
A changing part of the URL, converted and checked using its type hint.
Pydantic
The library FastAPI uses to define and check data shapes.
Query Parameter
Function parameters read from the `?key=value` query string.
Request Body
The JSON a client sends, read into a Pydantic model.
Response Model
The shape an endpoint returns; extra fields are filtered out.
Status Code in FastAPI
Set with `status_code=` on the decorator, such as 201 for created.
Type Hints in FastAPI
Type annotations FastAPI uses to check input and write docs.

Read them in the glossary