🎨 Auto format

This commit is contained in:
pre-commit-ci-lite[bot] 2026-01-22 12:23:43 +00:00 committed by GitHub
parent eec2fe9033
commit ee496848c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 1 deletions

View File

@ -55,7 +55,7 @@ For example, this model above declares a JSON "`object`" (or Python `dict`) like
}
```
### Required fields that can be `None`
### Required fields that can be `None` { #required-fields-that-can-be-none }
In Python type hints, a parameter can be **required** and still allow the value `None`.

View File

@ -3,9 +3,11 @@ from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
description: str | None
@app.post("/items/")
async def create_item(item: Item):
return item

View File

@ -1,12 +1,15 @@
from typing import Optional
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
description: Optional[str]
@app.post("/items/")
async def create_item(item: Item):
return item

View File

@ -1,9 +1,11 @@
import importlib
import pytest
from fastapi.testclient import TestClient
from ...utils import needs_py310
@pytest.fixture(
name="client",
params=[