-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
CLICommand line agruments and related codeCommand line agruments and related codeenhancementNew feature or requestNew feature or requestwontfixThis will not be worked onThis will not be worked on
Description
Describe
It would be great if there is an option to add the values from json as default values in the Model
Reproduce (Optional)
Package version: ...
JSON data:
{
"name": "John Smith",
"hometown": {
"name": "New York",
"id": 123
}
}
...
Desired result
A clear and concise description of what you want to happen.
Class code:
r"""
generated by json2python-models v0.2.4 at Tue Oct 19 22:08:54 2021
command: /Users/teodor.tenev/PycharmProjects/TestProj/venv/bin/json2models -m Car package.json -f dataclasses
"""
from dataclasses import dataclass, field
from typing import Literal
@dataclass
class Hometown:
name: Literal["New York"] = 'New York'
id_: int = 123
@dataclass
class Car:
hometown: 'Hometown' = Hometown()
name: Literal["John Smith"] = 'John Smith'
...
Metadata
Metadata
Assignees
Labels
CLICommand line agruments and related codeCommand line agruments and related codeenhancementNew feature or requestNew feature or requestwontfixThis will not be worked onThis will not be worked on