Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

field skips don't work with custom serializer? #244

Open
AustinScola opened this issue Jun 21, 2022 · 1 comment
Open

field skips don't work with custom serializer? #244

AustinScola opened this issue Jun 21, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@AustinScola
Copy link

I think that skip_if_default, skip_if_false, and skip_if don't work if there is a custom serializer?

Example:

from serde import serde, field
from dataclasses import dataclass
from serde.json import to_json

@serde
@dataclass
class Foo:
    bar: str = field(
        default="bar",
        serializer=lambda x: "...",
        skip_if_default=True,
    )

print(to_json(Foo()))  # prints '{"bar":"..."}'
@yukinarit yukinarit added the enhancement New feature or request label Jul 5, 2022
@yukinarit
Copy link
Owner

It is actually intended behavior but I will double-check if this is possible 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants