from dataclasses import dataclass, field
from dataclasses_json import DataClassJsonMixin, Exclude, config
@dataclass
class MyClass(DataClassJsonMixin):
my_field: int = field(metadata=config(exclude=Exclude.ALWAYS))
print(MyClass(0).to_dict())
# {}
print(MyClass.schema().dump(MyClass(0)))
# {'my_field': 0}
I expect
{}
for both outputs.This was mentioned by @whisust in https://github.com/lidatong/dataclasses-json/issues/187#issuecomment-767815878 but deserves its own issue.