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

feat: support declaring DTOField via Annotated #3289

Merged
merged 5 commits into from
Mar 30, 2024

Conversation

peterschutt
Copy link
Contributor

@peterschutt peterschutt commented Mar 30, 2024

Description

E.g.:

class A(Struct):
    a: Annotated[int, dto_field("read_only")]

Deprecates passing DTOField via pydantic extra, e.g., no longer supported:

class Model(BaseModel):
    a: int = Field(**dto_field("read-only"))

Closes

Closes #2351

peterschutt and others added 3 commits March 30, 2024 12:08
E.g.:

```py
class A(Struct):
    a: Annotated[int, dto_field("read_only")]
```

For #2351
Co-authored-by: Jacob Coffee <[email protected]>
Copy link

codecov bot commented Mar 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.25%. Comparing base (03b63e6) to head (64734fd).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3289   +/-   ##
========================================
  Coverage    98.25%   98.25%           
========================================
  Files          322      322           
  Lines        14684    14699   +15     
  Branches      2335     2339    +4     
========================================
+ Hits         14428    14443   +15     
  Misses         117      117           
  Partials       139      139           

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

@peterschutt peterschutt force-pushed the annotated-dto-fields branch from 16aa52c to b332b50 Compare March 30, 2024 03:34
@peterschutt peterschutt force-pushed the annotated-dto-fields branch from b332b50 to 44559e3 Compare March 30, 2024 03:36
Copy link

Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3289

@provinzkraut provinzkraut linked an issue Mar 30, 2024 that may be closed by this pull request
4 tasks
@peterschutt peterschutt merged commit 33de277 into develop Mar 30, 2024
24 checks passed
@peterschutt peterschutt deleted the annotated-dto-fields branch March 30, 2024 10:16
cofin pushed a commit that referenced this pull request Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: __dto__ key for pydantic.Field is deprecated and will be removed in v3
2 participants