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

Custom types are not honored with certain Field constraints #598

Closed
kevinjacobs-delfi opened this issue Apr 11, 2024 · 0 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@kevinjacobs-delfi
Copy link
Contributor

Describe the bug
Custom types are not honored with certain Field constraints.

from pydantic import Field
from dataclasses_avroschema.pydantic import AvroBaseModel
from dataclasses_avroschema.types import Int32

class A(AvroBaseModel):
    a: Int32

class B(AvroBaseModel):
    b: Int32 = Field(ge=0)

print(A.avro_schema())
print(B.avro_schema())

which outputs

{"type": "record", "name": "A", "fields": [{"name": "a", "type": "int"}]}
{"type": "record", "name": "B", "fields": [{"name": "b", "type": "long"}]}

where B's type is long and not int as I would expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants