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
The latest pydantic 2.7.0 seems to break with enums (works fine with pydantic<=2.6.4). We have a model defined roughly as:
from enum import IntEnum
from pydantic_xml import element, BaseXmlModel
class MyEnum(IntEnum):
VALUE = 1
class MyType(BaseXmlModel):
v: MyEnum = element()
Upon loading the file we see:
../../miniconda3/envs/envoy311/lib/python3.11/site-packages/envoy_schema/server/schema/sep2/types.py:177: in <module>
class UnitValueType(base.BaseXmlModelWithNS):
../../miniconda3/envs/envoy311/lib/python3.11/site-packages/pydantic_xml/model.py:268: in __new__
cls.__build_serializer__()
../../miniconda3/envs/envoy311/lib/python3.11/site-packages/pydantic_xml/model.py:339: in __build_serializer__
serializer = Serializer.parse_core_schema(
../../miniconda3/envs/envoy311/lib/python3.11/site-packages/pydantic_xml/serializers/serializer.py:180: in parse_core_schema
return cls.select_serializer(schema, ctx)
../../miniconda3/envs/envoy311/lib/python3.11/site-packages/pydantic_xml/serializers/serializer.py:237: in select_serializer
return factories.model.from_core_schema(schema, ctx)
../../miniconda3/envs/envoy311/lib/python3.11/site-packages/pydantic_xml/serializers/factories/model.py:420: in from_core_schema
return ModelSerializer.from_core_schema(schema, ctx)
../../miniconda3/envs/envoy311/lib/python3.11/site-packages/pydantic_xml/serializers/factories/model.py:91: in from_core_schema
fields_serializers[field_name] = Serializer.parse_core_schema(model_field['schema'], field_ctx)
../../miniconda3/envs/envoy311/lib/python3.11/site-packages/pydantic_xml/serializers/serializer.py:179: in parse_core_schema
schema, ctx = cls.preprocess_schema(schema, ctx)
../../miniconda3/envs/envoy311/lib/python3.11/site-packages/pydantic_xml/serializers/serializer.py:186: in preprocess_schema
raise ModelError(f"type {schema_type} is not supported")
E pydantic_xml.errors.ModelError: type enum is not supported
The text was updated successfully, but these errors were encountered:
The latest pydantic 2.7.0 seems to break with enums (works fine with pydantic<=2.6.4). We have a model defined roughly as:
Upon loading the file we see:
The text was updated successfully, but these errors were encountered: