I am using data classes with mashumuro discriminat...
# ask-the-community
b
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
I am getting a key error when I use the MainConfig type in Flyte workflow
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.
k
does it work if you remove
kw_only=True
?