fastapi/fastapi
Glossary
Terms used throughout this wiki and in the FastAPI source.
| Term | Definition |
|---|---|
| Path operation | A function decorated with @app.get, @app.post, @app.put, etc. The decorator registers a route on an APIRouter. |
| Path operation function | The user-supplied function that handles a request. Its parameter signature is the input contract; its return value is the output contract. |
| Dependant | The dataclass in fastapi/dependencies/models.py that captures everything FastAPI inferred from a function signature: path/query/header/cookie/body params, sub-dependencies, security schemes, special parameters (Request, Response, BackgroundTasks, WebSocket, SecurityScopes), scope, cache key, etc. Each route owns one root Dependant; sub-dependencies form a tree. |
| Solve / Solve dependencies | The runtime step that takes a Dependant plus a Request/WebSocket and produces the kwargs to call the endpoint with, alongside validation errors. Implemented in solve_dependencies() in fastapi/dependencies/utils.py. |
| Param | A subclass of pydantic.FieldInfo that carries the marker for a parameter location: Path, Query, Header, Cookie, Body, Form, File. Defined in fastapi/params.py; thin functional wrappers live in fastapi/param_functions.py. |
| Body / Form / File | All three are Body-derived markers. Form switches the content type to application/x-www-form-urlencoded; File switches it to multipart/form-data and exposes UploadFile. |
Annotated style |
The recommended way to declare parameters since FastAPI ≥0.95: name: Annotated[str, Query(min_length=3)] = "default". The function default is a real default; the metadata describes the parameter. |
Depends / Security |
Markers (defined in fastapi/params.py) that mean "resolve this argument by calling another callable." Security additionally carries OAuth2 scopes. The callable can be sync, async, a generator (request-scoped), or an async generator. |
SecurityBase |
The base class (fastapi/security/base.py) every security scheme subclasses. solve_dependencies recognises a SecurityBase instance and feeds it to the OpenAPI schema as a securityScheme. |
Default(...) / DefaultPlaceholder |
Sentinel values (fastapi/datastructures.py) used when a parameter has a "framework default" that user code may override. The framework checks isinstance(x, DefaultPlaceholder) to know whether the value came from a user. |
response_model |
Optional Pydantic model passed to a path operation decorator. When set, FastAPI validates the return value against it before serializing, and uses it for the response schema in OpenAPI. |
response_class |
The Starlette Response subclass to render the return value with. Defaults to JSONResponse. Setting response_class=EventSourceResponse enables Server-Sent Events. |
generate_unique_id_function |
Callable that produces an operationId for OpenAPI from an APIRoute. Default is generate_unique_id in fastapi/utils.py. |
include_router |
Method on APIRouter (and FastAPI) that mounts a sub-router under a prefix and merges its routes, dependencies, tags, and responses. |
AsyncExitStack |
Python contextlib primitive used to drive cleanup for Depends(...) callables that yield. Three stacks live on the ASGI scope: fastapi_middleware_astack, fastapi_inner_astack, and fastapi_function_astack. |
jsonable_encoder |
The function in fastapi/encoders.py that converts arbitrary Python values to JSON-compatible primitives. Used internally for response serialization and for default exception handlers. |
EventSourceResponse / ServerSentEvent |
Server-Sent Events helpers in fastapi/sse.py. The encoding is performed by the routing layer, not by the response class; the class just sets Content-Type: text/event-stream. |
OAuth2PasswordRequestForm |
A dependency class (fastapi/security/oauth2.py) that pulls username, password, scope, etc. out of a form-encoded body. Pair with an OAuth2PasswordBearer scheme. |
SecurityScopes |
A class injected as a parameter that exposes the OAuth2 scopes required by the path operation. Used inside dependencies to perform scope-based authorization. |
include_in_schema |
Per-route boolean. When False, the route is omitted from the OpenAPI schema (still served, but invisible in /docs). |
docs_url / redoc_url / openapi_url |
URLs at which the FastAPI app serves Swagger UI, ReDoc, and the JSON schema. Setting any to None disables that surface. |
fastapi-slim |
An alternate PyPI distribution built from the same sources via the fastapi-slim/ directory. Differs only in default extras and metadata. |
docs_src |
Directory of runnable example apps used by the docs site. Tests under tests/test_tutorial/ import them, so they double as integration fixtures. |
| CodSpeed | The continuous performance regression service tests/benchmarks/ targets, via pytest-codspeed. |
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.
Previous
Getting started
Next
By the numbers