Hello, I have written a custom TypeTransformer for...
# flyte-support
c
Hello, I have written a custom TypeTransformer for a specific dataclass, call it
CustomDC
in my code - the reason for not using the default dataclass transformer is due to custom serialization logic I need to be able to in for this particular class. I now want to use
CustomDC
inside vanilla dataclasses, but flytekit doesn’t seem to be calling the custom type transformer on this class 🤔
Copy code
@custom_serde   # custom serde register CustomDC class to an ABC with serde logic
@dataclass
class CustomDC:
   fieldA: int
   fieldB: List[str]

@dataclass
class VanillaDC(DataClassJSONMixin):
   fieldX: List[int]
   fieldY: CustomDC
TLDR: how do I enable custom type transformer for certain fields of a dataclass?
r
I had to do something similar and ended up just using mashumaro’s configuration for it - you can provide custom serialization logic
gratitude thank you 2