Fix model fields with example=
kwargs
#39
Labels
API Spec
Errors or inconsistencies in the API spec
bug
Something isn't working
documentation
Improvements or additions to documentation
waiting
Waiting for 3rd party
Milestone
datamodel-code-generator
generatespydantic.Field
attributes with the kwargexample
which contains a single example value for the field:https://github.com/pederhan/harborapi/blob/705903fabc44c2e381bab55a75e1847a77032b98/harborapi/models/_models.py#L182-L191
However, in Pydantic V2, this is now called
examples
¹ ² and is a list of examples. TheScanner
snippet above should be changed to the following:If this isn't fixed in datamodel-code-generator soon, we either have to try to contribute the fix ourselves, or we have to perform some AST manipulation to rewrite all instances of
example
.1: https://docs.pydantic.dev/latest/api/fields/#pydantic.fields.Field
2: https://docs.pydantic.dev/latest/concepts/fields/#customizing-json-schema
The text was updated successfully, but these errors were encountered: