I am using data classes with mashumuro discriminators, as in
Copy code
@dataclass(kw_only=True)
class CustomConfig(DataClassJSONMixin):
class Config(BaseConfig):
discriminator = Discriminator(
field="type",
include_subtypes=True,
)
@dataclass(kw_only=True)
class MyCustomConfig(CustomConfig):
type: str = "my_custom"
foo: int
@dataclass(kw_only=True)
class MyOtherCustomConfig(CustomConfig):
type: str = "my_other_custom"
bar: int
@dataclass(kw_only=True)
class MainConfig(DataClassJSONMixin):
custom_config: CustomConfig
fierce-oil-47448
05/21/2024, 8:03 PM
I am getting a key error when I use the MainConfig type in Flyte workflow
fierce-oil-47448
05/21/2024, 8:05 PM
It is a key error if I have the discriminator as:
type: str = "my_custom"
If I instead use
type = "my_custom"
Then it is an invalid value error.