-
Notifications
You must be signed in to change notification settings - Fork 156
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
Containers of extended types do not work [bug] #191
Labels
bug
Something isn't working
Comments
@AndreyMZ FYI, in the meantime you can fix it by doing something like that for extended types: from dataclasses import dataclass, field
from datetime import date
from dataclasses_json import dataclass_json, config
from marshmallow import fields
@dataclass_json
@dataclass
class myDataclass:
date_field:date = field(
metadata=config(
encoder=lambda d: date.isoformat(d) if d else None,
decoder=lambda d: date.fromisoformat(d) if d else None,
mm_field=fields.Date(format="iso"),
)
) @lidatong Thanks for looking into it, we have this kind of workaround scattered in our codebase and it's quite brittle as if you forget to add it, you will end up with date vs str or uuid vs str etc.. it breaks comparisons. |
dax
added a commit
to dax/dataclasses-json
that referenced
this issue
Apr 27, 2022
dax
added a commit
to dax/dataclasses-json
that referenced
this issue
Sep 22, 2022
dax
added a commit
to dax/dataclasses-json
that referenced
this issue
Jun 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce
Run the following tests by pytest:
Actual result
test_foo
passed.test_bar
failed:Expected result
Both tests passed.
The text was updated successfully, but these errors were encountered: