Add collapse root model feature (#933)

* Add collapse root model feature

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove unused root type model

* Update unittest

* ignore coverage

* copy field arguments

* Update documents

Co-authored-by: ferris <ferris@devdroplets.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Koudai Aono <koxudaxi@gmail.com>
This commit is contained in:
C2D
2022-12-28 16:53:24 +01:00
committed by GitHub
parent 7e43bcd699
commit c7ee6c84d2
12 changed files with 172 additions and 5 deletions

View File

@@ -56,7 +56,7 @@ usage: datamodel-codegen [-h] [--input INPUT] [--url URL]
[--disable-timestamp] [--use-standard-collections]
[--use-generic-container-types]
[--use-schema-description] [--use-field-description] [--reuse-model]
[--enum-field-as-literal {all,one}]
[--collapse-root-models] [--enum-field-as-literal {all,one}]
[--set-default-enum-member]
[--empty-enum-field-name EMPTY_ENUM_FIELD_NAME]
[--special-field-name-prefix SPECIAL_FIELD_NAME_PREFIX]
@@ -131,6 +131,9 @@ optional arguments:
Use schema description to populate field docstring
--reuse-model Re-use models on the field when a module has the model
with the same content
--collapse-root-models
Models generated with a root-type field will be
merged into the models using that root-type model
--enum-field-as-literal {all,one}
Parse enum field as literal. all: all enum field type
are Literal. one: field type is Literal when an enum