Skip to content

Releases: koxudaxi/datamodel-code-generator

0.21.5

06 Sep 16:35
04c8b68
Compare
Choose a tag to compare

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

Full Changelog: 0.21.4...0.21.5

0.21.4

09 Aug 18:39
de82679
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 0.21.3...0.21.4

0.21.3

03 Aug 17:47
0deef65
Compare
Choose a tag to compare

What's Changed

  • Give Pydantic V2 its own dump_resolve_reference_action to use model_rebuild not update_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 bare generate 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

Full Changelog: 0.21.2...0.21.3

0.21.2

20 Jul 15:59
b63693a
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 0.21.1...0.21.2

0.21.1

06 Jul 07:24
f172a5a
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 0.21.0...0.21.1

0.21.0

03 Jul 03:34
f927068
Compare
Choose a tag to compare

What's Changed

New Contributors

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

06 Jun 15:19
dcf11fc
Compare
Choose a tag to compare

What's Changed

Breaking Changes

  • Eliminate the naming differences of model names and field names by the OS by @koxudaxi in #1348

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

Full Changelog: 0.19.0...0.20.0

0.19.0

10 May 16:23
8855a13
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 0.18.1...0.19.0

0.18.1

27 Apr 15:40
3c69582
Compare
Choose a tag to compare

What's Changed

Full Changelog: 0.18.0...0.18.1

0.18.0

16 Apr 17:18
03eeddb
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 0.17.2...0.18.0