Generate avro schemas from python dataclasses, Pydantic models and Faust Records. Code generation from avro schemas. Serialize/Deserialize python instances with avro schemas.
Describe the bug
If you try to get avro schema from a pydantic model multiple times it starts ignoring the exclude_default feature
To Reproduce
import uuid
from dataclasses_avroschema.pydantic import AvroBaseModel
from pydantic import Field
class Test(AvroBaseModel):
id: str = Field( # type: ignore[call-arg]
default_factory=lambda: str(uuid.uuid4()), metadata={"exclude_default": True}
)
a = Test()
print(a.avro_schema()) # it's works as expected
print(a.avro_schema()) # it's not works as expected and the defaults are included inside the schema
as a workaround I've overridden the method avro_schema by putting the cache decorator
Describe the bug If you try to get avro schema from a pydantic model multiple times it starts ignoring the exclude_default feature
To Reproduce
as a workaround I've overridden the method avro_schema by putting the cache decorator
Expected behavior It should always exclude the default