Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if class instance has default value, there is issue with result #47

Closed
lcalviny opened this issue Jun 15, 2020 · 2 comments
Closed

if class instance has default value, there is issue with result #47

lcalviny opened this issue Jun 15, 2020 · 2 comments

Comments

@lcalviny
Copy link

@DataClass
class User(AvroModel):
"User with multiple Address"
name: str = None
age: int = None
addresses: typing.List[Address]

address_data = {
"street": "street",
"street_number": 10,
}

create an Address instance

address = Address(**address_data)

data_user = {
# "name": None,
# "age": 20,
"addresses": [address],
}

create an User instance

user = User(**data_user)

a = user.to_json()

result:
{'name': None, 'age': {'int': 20}, 'addresses': [{'street': 'street', 'street_number': 10}]}

you can see age is {'int':20} instead of 'age':20

@marcosschroh
Copy link
Owner

Hi @lcalviny ,

Yes, the serialization and json features are in a beta state. I will try to fix all the issues asap.

Thanks

@marcosschroh
Copy link
Owner

closed by #48

You can check it with the latest version 0.14.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants