Overview
FastAPI 0.118, released on February 1, 2025, brings performance improvements and better automatic documentation.
Main Features
Performance improvements
Response serialization is optimized with better Pydantic v2 model support and streaming.
python
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
price: float
@app.post('/items/')
async def create_item(item: Item):
return {'name': item.name, 'price_ttc': item.price * 1.2}
OpenAPI documentation
OpenAPI documentation generation is improved with better support for complex types and examples.
python
from fastapi import FastAPI, Query
app = FastAPI(title='My API', version='1.0')
@app.get('/search/')
async def search(
q: str = Query(min_length=3, examples=['python', 'fastapi']),
limit: int = Query(default=10, le=100),
):
return {'query': q, 'limit': limit}
