Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
```
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion json_to_models/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down