phi-friday commented on PR #41363:
URL: https://github.com/apache/airflow/pull/41363#issuecomment-2278522365

   I don't know if this is allowed.
   Modifying the model as follows did not cause the problem,
   even if it was `pydantic<2` or `none` (I checked in local).
   
   #### in `airflow.utils.pydantic`
   
   ```python
   if is_pydantic_2_installed():
       from pydantic import BaseModel, ConfigDict, PlainSerializer, 
PlainValidator, ValidationInfo
   else:
   
       class BaseModel:  # type: ignore[no-redef]  # noqa: D101
           def __init__(self, *args, **kwargs):
               self.__dict__.update(kwargs)
   
           @classmethod
           def model_validate(cls, value: object):
               args = {name: getattr(value, name, None) for name in 
cls.__annotations__}
               return cls(**args)
   
           def model_dump(self, *args, **kwargs):
               from airflow.serialization.serialized_objects import 
BaseSerialization
   
               return {
                   name: BaseSerialization.serialize(getattr(self, name, None), 
use_pydantic_models=True)
                   for name in self.__annotations__
               }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to