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: no signature model data validation if DTO #2854

Merged
merged 1 commit into from Dec 8, 2023

Conversation

peterschutt
Copy link
Contributor

By the time the signature model is parsed, the DTO has already validated and built the object to be injected as data, so we don't need the signature model to do it again.

This PR ensures that data fields are typed as Any on the signature model so that validation doesn't occur twice.

This is a regression introduced in #2088, so I've added an explicit test for it.

Closes #2149

@peterschutt peterschutt requested review from a team as code owners December 8, 2023 10:11
By the time the signature model is parsed, the DTO has already validated and built the object to be injected as `data`, so we don't need the signature model to do it again.

This PR ensures that `data` fields are typed as `Any` on the signature model so that validation doesn't occur twice.

This is a regression introduced in #2088, so I've added an explicit test for it.

Closes #2149
Copy link

sonarcloud bot commented Dec 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link

github-actions bot commented Dec 8, 2023

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

Copy link
Member

@guacs guacs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noice!

@peterschutt peterschutt merged commit 3b0af1a into main Dec 8, 2023
17 checks passed
@peterschutt peterschutt deleted the 2149-dto-data-sig-type-any branch December 8, 2023 11:38
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: SQA MappedAsDataclass breaks DTO for request body?
2 participants