-
-
Notifications
You must be signed in to change notification settings - Fork 344
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: Validation of optional sequence in multipart data with one value #3408
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3408 +/- ##
=======================================
Coverage 98.29% 98.29%
=======================================
Files 328 328
Lines 14864 14865 +1
Branches 2358 2358
=======================================
+ Hits 14610 14611 +1
Misses 116 116
Partials 138 138 ☔ View full report in Codecov by Sentry. |
354094f
to
1eac15a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the case where the annotation is directly on the handler itself also needs to be handled. I don't think there's a test for it.
def handler(data: list[UploadFile] | None): ...
I think that one is already handled but I haven't actually checked it, I assumed we were testing that already. Can't check right now as I'm on the road but I'll do once I'm back home. |
There does seem to be an issue with this too, but its failing when there are 2 or more files provided. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment can be ignored since another issue for that case was created. LGTM!
1eac15a
to
e06caa6
Compare
Oops. I fixed it here before that PR was created 😬 |
No, I'm happy for it to go though here. |
@provinzkraut I think we can safely ignore reportGeneralTypeIssues line 405 of multipart, merge this and close @peterschutt competing one, wdyt ? |
Don't have time rn to do this but if you want, feel free to take this on. |
Quality Gate passedIssues Measures |
Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3408 |
Fix #3407.
A
Sequence[UploadFile] | None
would not pass validation when a single value was provided for a structured type, e.g. dataclass.