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

Fix type error from field with attributes #458

Merged
merged 1 commit into from
Jan 6, 2024
Merged

Fix type error from field with attributes #458

merged 1 commit into from
Jan 6, 2024

Conversation

yukinarit
Copy link
Owner

@yukinarit yukinarit commented Jan 6, 2024

This commit fixes pyright type error from field with attributes. You still get type error with mypy v1.8.0 as mypy still does not fully support dataclass_transform

from dataclasses import dataclass
from serde import serde, field

@serde
@dataclass
class Foo:
    id: int = field(rename="ID")
    comments: str

Closes #457

@yukinarit yukinarit marked this pull request as ready for review January 6, 2024 04:02
Copy link

github-actions bot commented Jan 6, 2024

Please consider formatting your code according to the standards described here: https://github.com/yukinarit/pyserde/blob/main/CONTRIBUTING.md

Copy link

codecov bot commented Jan 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d25d2bd) 89.59% compared to head (ed5c98e) 89.59%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #458   +/-   ##
=======================================
  Coverage   89.59%   89.59%           
=======================================
  Files          12       12           
  Lines        1912     1912           
  Branches      397      397           
=======================================
  Hits         1713     1713           
  Misses        145      145           
  Partials       54       54           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This commit fixes pyright type error from field with attributes.
You still get type error with mypy v1.8.0 as mypy still does not
fully support dataclass_transform
```
from dataclasses import dataclass
from serde import serde, field

@serde
@DataClass
class Foo:
    id: int = field(rename="ID")
    comments: str
```
@yukinarit yukinarit merged commit f3e0cdd into main Jan 6, 2024
9 checks passed
@yukinarit yukinarit deleted the field-order branch January 6, 2024 05:51
github-actions bot pushed a commit that referenced this pull request Jan 6, 2024
@yukinarit yukinarit added the enhancement New feature or request label Jan 7, 2024
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
None yet
Development

Successfully merging this pull request may close these issues.

Type error from field with attributes
1 participant