diff --git a/README.md b/README.md index 4f4d800..2ae80f0 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ from JSON dataset. * Handling **recursive data** structures (i.e family tree) * Detecting **string serializable types** (i.e. datetime or just stringify numbers) * Detecting fields containing string constants (`Literal['foo', 'bar']`) -* Generation models as **tree** (nested models) or **list** +* Generation models as **list** (flat models structure) or **tree** (nested models) * Specifying when dictionaries should be processed as **`dict` type** (by default every dict is considered as some model) * **CLI** API with a lot of options @@ -103,7 +103,7 @@ driver_standings.json ``` ``` -json2models -f pydantic -s flat -l DriverStandings - driver_standings.json +json2models -f pydantic -l DriverStandings - driver_standings.json ``` ```python @@ -161,7 +161,7 @@ It requires a lit bit of tweaking: * Disable string literals ``` -json2models -s flat -f dataclasses -m Swagger testing_tools/swagger.json \ +json2models -f dataclasses -m Swagger testing_tools/swagger.json \ --dict-keys-fields securityDefinitions paths responses definitions properties \ --merge percent_50 number --max-strings-literals 0 ``` @@ -338,9 +338,9 @@ Arguments: * **Default**: `-f base` * `-s`, `--structure` - Models composition style. - * **Format**: `-s {nested, flat}` - * **Example**: `-s flat` - * **Default**: `-s nested` + * **Format**: `-s {flat, nested}` + * **Example**: `-s nested` + * **Default**: `-s flat` * `--datetime` - Enable datetime/date/time strings parsing. * **Default**: disabled diff --git a/json_to_models/cli.py b/json_to_models/cli.py index 22c4b33..dfbea00 100644 --- a/json_to_models/cli.py +++ b/json_to_models/cli.py @@ -268,7 +268,7 @@ def _create_argparser(cls) -> argparse.ArgumentParser: ) parser.add_argument( "-s", "--structure", - default="nested", + default="flat", choices=list(cls.STRUCTURE_FN_MAPPING.keys()), help="Models composition style. By default nested models become nested Python classes.\n\n" )