FastAPI's power comes from Python type annotations. In code reviews and technical interviews, you'll need precise vocabulary for Pydantic models, dependency injection, and async route handlers.
0 / 5 completed
1 / 5
A Python developer says: 'FastAPI uses type hints for validation automatically.' What are type hints in this context?
Type hints (PEP 484) are Python annotations that declare the expected type of a variable or parameter: name: str, age: int. FastAPI reads these hints at runtime via Pydantic to validate incoming request data automatically and generate OpenAPI documentation. When a developer says 'add type hints,' they mean annotate parameters with their expected types.
2 / 5
In a code review, someone writes: 'Use a Pydantic model for the request body.' What does this mean?
A Pydantic model is a class that inherits from BaseModel and uses type annotations to define its fields. FastAPI uses Pydantic models to parse and validate request bodies, generating clear error messages when data is invalid. In discussions: 'Define a Pydantic model for this endpoint' means create a structured class instead of using a plain dictionary.
3 / 5
A FastAPI developer says: 'Declare that as a query parameter, not a path parameter.' What is the distinction?
Path parameters are embedded in the URL path: /users/{user_id}. Query parameters come after the ?: /users?page=2&limit=10. In FastAPI, path params use curly braces in the route decorator, while query params are just function arguments without a path match. This distinction matters in API design discussions — path params identify resources, query params filter or modify the response.
4 / 5
A code review comment reads: 'Add an async keyword here — this endpoint does I/O.' Why is this important in FastAPI?
FastAPI is built on Starlette and supports async Python. Declaring a route handler as async def means FastAPI can suspend it during I/O operations (database queries, HTTP calls) and serve other requests in the meantime. This is called cooperative concurrency. The distinction between def and async def is important when discussing performance in FastAPI services.
5 / 5
A developer says: 'Use dependency injection for the database session.' In FastAPI, what does this mean?
FastAPI's Depends() function is its dependency injection system. Instead of creating a database session inside each route handler, you declare it as a dependency: db: Session = Depends(get_db). FastAPI manages creating and closing the session. This pattern makes code more testable and reusable — in reviews, 'use DI for the session' means extract it into a dependency function.