dataclasses-json icon indicating copy to clipboard operation
dataclasses-json copied to clipboard

How to pass undefined=Undefined.EXCLUDE via mixin?

Open TonalidadeHidrica opened this issue 3 years ago • 2 comments

I can use @dataclasses(undefined=Undefined.EXCLUDE) as an annotation to a class definition to specify the behavior for undefined fields. How can I specify it when I used Mixin instead of annotation?

TonalidadeHidrica avatar Sep 21 '20 09:09 TonalidadeHidrica

I came across this somewhere.

@dataclass
class ApiRequest(DataClassJsonMixin):
    dataclass_json_config = config(
        letter_case=LetterCase.CAMEL,
        undefined=Undefined.EXCLUDE
    )['dataclasses_json']

See https://github.com/lidatong/dataclasses-json/issues/194.

nrhoffmann avatar Nov 13 '20 18:11 nrhoffmann

I was looking for this, thank you! I think this should end up in the documentation as well.

g0di avatar Dec 03 '20 07:12 g0di

I was looking for this in the documentation, but couldn't find it.
Please consider adding it to the docs.

felixp98 avatar May 02 '24 11:05 felixp98