rokadepiyush49-rgb commented on issue #51016:
URL: https://github.com/apache/airflow/issues/51016#issuecomment-7112661797
I'd like to pick this up before it gets closed as stale. `serialize()` hits
the `_primitives` fast path for `IntEnum`/`StrEnum` and returns `o.value`, so
the class is lost on the way back:
```mermaid
flowchart TD
O[MyEnum.A] --> E{Enum check first?}
E -- no, today --> V[comes back as plain 1]
E -. yes, proposed .-> C[encode class name and value]
C --> A{class allowed?}
A -- yes --> M[MyEnum.A]
A -- no --> V
```
Idea: check for `enum.Enum` before the primitive fast path, encode the class
name with the value, and only rebuild the member if the class passes
`allowed_deserialization_classes`. Old payloads keep working as plain values.
@bolkedebruin, does that match what you meant about checking exact types
instead of `isinstance`? And should this bump the serde version?
--
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]