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.
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
```
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too