Open kamilglod opened 1 month ago
Hi @kamilglod
I think adding a flag called use_original_schema: bool = False
to serialize
method is a good idea.
If the original_schema
was included in class Meta
and the flag was set to True then the original_schema will be used, any other combination will be the fallback schema.
Also, this new flag might have to be added to the deserialize
, which requires a bit more of refinement because we can use already 2 schemas to deserialize (contained schema and writer schema)
Is your feature request related to a problem? Please describe. I generate dataclass models from AVRO schema that other team provides, and I want to be sure that I'm generating AVRO data using exact same schema. So I'm building python instance and now I want to call
.serialize()
but it uses only auto-generated schema from model, there is no option to useoriginal_schema
Describe the solution you'd like It would be nice to have either separate method or flag as an argument of the
.serialize()
method, something likeuse_original_schema: bool = False
(for meTrue
should be default but it would break backward compatibility)Describe alternatives you've considered Creating helper function in my code that would be used alywas to serialize model: