Releases: koxudaxi/datamodel-code-generator
0.21.5
What's Changed
- Added protect namespace to Pydantic v2 ConfigDict by @willarmiros in #1489
- Fix pydantic 2.2.1 RootModel cannot have extra_fields error by @i404788 in #1497
- Add missing default=None by @twoodwark in #1515
- Fix class Field generated when array with name fields with oneOf inside by @mjperrone in #1516
New Contributors
- @willarmiros made their first contribution in #1489
- @twoodwark made their first contribution in #1515
- @mjperrone made their first contribution in #1516
Full Changelog: 0.21.4...0.21.5
0.21.4
What's Changed
- Update openapi-spec-validator to 0.5.7 by @der-eismann in #1475
- Fix Pydantic V2 RootModel inheritance by @barreeeiroo in #1477
- main: fix configuration model validation after CLI args merge by @airwoodix in #1448
- Fix const for pydantic_v2 by @koxudaxi in #1482
- Unique list is defined as list by @koxudaxi in #1484
- switch away from deprecated pydantic method by @iliakur in #1485
- Fix condecimal by @koxudaxi in #1487
- Add unittest for discriminator by @koxudaxi in #1488
New Contributors
- @der-eismann made their first contribution in #1475
- @barreeeiroo made their first contribution in #1477
- @iliakur made their first contribution in #1485
Full Changelog: 0.21.3...0.21.4
0.21.3
What's Changed
- Give Pydantic V2 its own
dump_resolve_reference_action
to usemodel_rebuild
notupdate_forward_refs
by @lmmx in #1468 - fix: Fix regex expression of hostname in pydantic v2 by @xu-cheng in #1449
- Add
base_class
validation similar to_validate_base_class
to baregenerate
calls by @kylebebak in #1453 - Fix issue #1461: Open API parameter models use base class if set by @piercsi in #1462
- Issues 1454 typeddict not required optional bug fix by @kylebebak in #1457
New Contributors
- @lmmx made their first contribution in #1468
- @xu-cheng made their first contribution in #1449
- @kylebebak made their first contribution in #1453
- @piercsi made their first contribution in #1462
Full Changelog: 0.21.2...0.21.3
0.21.2
What's Changed
- Pre-commit-hooks by @yehoshuadimarsky in #1416
- feat: add additional imports by @skonik in #1422
- Add orm_mode to Config(BaseModel) by @Beaueve in #1425
- Fix "parent" AttributeError when calling --collapse-root-models by @imankulov in #1432
New Contributors
- @yehoshuadimarsky made their first contribution in #1416
- @skonik made their first contribution in #1422
- @Beaueve made their first contribution in #1425
- @imankulov made their first contribution in #1432
Full Changelog: 0.21.1...0.21.2
0.21.1
0.21.0
What's Changed
- pyproject: correct poetry-core package name by @ConnorBaker in #1374
- Support pydantic v2 in runtime by @koxudaxi in #1392
- Add pydantic v2 as output model type by @koxudaxi in #1391
- Add --use-unique-items as set by @koxudaxi in #1400
New Contributors
- @ConnorBaker made their first contribution in #1374
What is the difference between pydantic v1 and v2 output model?
Summary
datamodel-code-generator supports Pydantic v1 and v2 as output model type.
Pydantic v2 is a major release with many breaking changes. See the migration guide for more information:
https://docs.pydantic.dev/2.0/migration/
What's changes in v2 output?
__root__
field (a.k.a Custom Root Types)
__root__
field (a.k.a Custom Root Types) is removed in pydantic v2.
The model is changed to RootModel
pydantic.Field
https://docs.pydantic.dev/2.0/migration/#changes-to-pydanticfield
- const -> removed
- min_items (use min_length instead)
- max_items (use max_length instead)
- unique_items -> removed and the list type will be replaced by
typing.Set
. this feature is discussed in pydantic/pydantic-core#296 - allow_mutation (use frozen instead)
- regex (use pattern instead)
Model Config
pydantic.Config
->pydantic.ConfigDict
- allow_mutation —> frozen (inverse value for getting same behavior).
- allow_population_by_field_name → populate_by_name
Full Changelog: 0.20.0...0.21.0
0.20.0
What's Changed
- Update documentation by @noddycode in #1316
- Support TypedDict as output type by @koxudaxi in #1309
- Remove self attribute from jsonschema root attributes by @rezen in #1318
- Fix $ref With Path Items by @zach-hamm in #1323
- Remove keep-runtime-typing on ruff config by @koxudaxi in #1349
- Update
openapi-spec-validator
to0.5.2
by @Fokko in #1343 - Added support for model wise base classes by @senesh-deshan in #1350
- Fix the custom file header by @Fokko in #1346
Breaking Changes
Due to differences in file loading order between operating systems, we've added a sorting process when fetching file listings within directories in order to eliminate discrepancies in model and field names. As a result, model names that differ from those generated by existing earlier versions may be produced.
New Contributors
- @noddycode made their first contribution in #1316
- @rezen made their first contribution in #1318
- @zach-hamm made their first contribution in #1323
- @Fokko made their first contribution in #1343
- @senesh-deshan made their first contribution in #1350
Full Changelog: 0.19.0...0.20.0
0.19.0
What's Changed
- Import Annotated from typing_extensions for Python <= 3.8 by @airwoodix in #1274
- Fix OpenAPI array response by @koxudaxi in #1261
- Fix unresolved nested ref in openapi by @koxudaxi in #1269
- Fix unsorted dataclass field by @koxudaxi in #1288
- Fix allOf-anyOf by @koxudaxi in #1291
- Fix null by @koxudaxi in #1299
New Contributors
- @airwoodix made their first contribution in #1274
Full Changelog: 0.18.1...0.19.0
0.18.1
What's Changed
- default_factory field should be non-optional by @koxudaxi in #1254
- add --use-one-literal-as-default by @koxudaxi in #1256
- (🎁) Include
py.typed
to mark project as typed by @KotlinIsland in #1259 - Fix min/max on number fields truncated by @koxudaxi in #1266
- Add use_operation_id_as_name by @koxudaxi in #1267
- Add datetime to number and integer by @koxudaxi in #1268
Full Changelog: 0.18.0...0.18.1
0.18.0
What's Changed
- Update all to expose needed types by @ShaneMurphy2 in #1230
- Fix max min round issue by @koxudaxi in #1235
- Fix strict nullable for default factory by @koxudaxi in #1236
- Improve union types by @koxudaxi in #1241
- Support nested all_of by @koxudaxi in #1242
- (🎁) bump some dependencies by @KotlinIsland in #1245
- (🎁) log file type when
--input-file-type
is auto. by @KotlinIsland in #1248 - (🎁) remove typed-ast dependency by @KotlinIsland in #1246
- (🎁) reference config option to specify input type by @KotlinIsland in #1250
- (🎁) infer data vs schema when
--input-file-type
is auto by @KotlinIsland in #1249
New Contributors
- @ShaneMurphy2 made their first contribution in #1230
Full Changelog: 0.17.2...0.18.0