You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Should dictionary representations be deserializable when using "avro-json" I find a case where "avro" works but "avro-json" does not (ps. cool repo!).
To Reproduce
Take your original Address+User examples and changing typing.List -> typing.Dict[str,Address]
import typing
import dataclasses
from dataclasses_avroschema import AvroModel
@dataclasses.dataclass
class Address(AvroModel):
"An Address"
street: str
street_number: int
@dataclasses.dataclass
class User(AvroModel):
"User with multiple Address"
name: str
age: int
addresses: typing.Dict[str, Address]
user = User.fake()
# Fails with error "ValueError: no value and no default" raised from generator fastavro.json_reader(input_stream, schema)
serialization_type = 'avro-json'
s = user.serialize(serialization_type=serialization_type)
User.deserialize(s, serialization_type=serialization_type)
Expected behavior
The same output as with the "avro" serialization type (as below) - just wanted to report this and confirm that this is the expected behaviour?
# Works fine
serialization_type = 'avro'
s = user.serialize(serialization_type=serialization_type)
User.deserialize(s, serialization_type=serialization_type)
The text was updated successfully, but these errors were encountered:
mattreid9956
changed the title
typing.List[AvroModel] works but typing.Dict[str, AvroModel]
typing.List[AvroModel] works but typing.Dict[str, AvroModel] seems to fail
Jul 18, 2022
Describe the bug
Should dictionary representations be deserializable when using "avro-json" I find a case where "avro" works but "avro-json" does not (ps. cool repo!).
To Reproduce
Take your original Address+User examples and changing typing.List -> typing.Dict[str,Address]
Expected behavior
The same output as with the "avro" serialization type (as below) - just wanted to report this and confirm that this is the expected behaviour?
python: 3.7.8
dataclasses-avroschema==0.30.0
fastavro==1.5.2
The text was updated successfully, but these errors were encountered: