My project has
[tool.poetry.dependencies]
python = "^3.11"
fastapi = "0.110.3"
[tool.poetry.group.dev.dependencies]
fastapi-code-generator = "^0.5.0"
which results in datamodel-code-generator 0.25.6 I'm getting models like this generated:
api_version: Optional[str] = Field(
None,
description='Indication of the API version implemented at this URL. Must be "v0.4.2" when implementing this version of the API.',
example='v0.4.2',
)
But Pydantic Field has no argument example. It has examples though.
Example file
This appears to be because this is an OpenAPI 3.0.2 file, and apparently in [OAI 3.1[(https://redocly.com/docs/openapi-visual-reference/schemas/#example-and-examples) example changes to examples.
components:
schemas:
StatusResponse:
type: object
required:
- status
properties:
api_version:
description: |-
Indication of the API version implemented at this URL. Must be "v0.4.2" when implementing this version of the API.
type: string
example: v0.4.2
```
My project has
which results in
datamodel-code-generator 0.25.6I'm getting models like this generated:But Pydantic
Fieldhas no argumentexample. It hasexamplesthough.Example file
This appears to be because this is an OpenAPI 3.0.2 file, and apparently in [OAI 3.1[(https://redocly.com/docs/openapi-visual-reference/schemas/#example-and-examples)
examplechanges toexamples.