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 scalar as list with multi selects #141

Merged
merged 3 commits into from
May 30, 2024

Conversation

schatimo
Copy link
Contributor

This PR fixes #122.

Copy link

codecov bot commented Dec 31, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cec25c6) 94.05% compared to head (ef4a424) 94.05%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #141   +/-   ##
=======================================
  Coverage   94.05%   94.05%           
=======================================
  Files          11       11           
  Lines         723      723           
=======================================
  Hits          680      680           
  Misses         43       43           

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

@schatimo schatimo changed the title fix scalar as list with multi selects #122 fix scalar as list with multi selects Dec 31, 2023
@samuelcolvin
Copy link
Member

Looks good, please can you add a test, also I think there's another field that needs the same.

@schatimo
Copy link
Contributor Author

Sure, I added a test for the validation method to make sure that we get a 200 response when the argument is a str but the pydantic model expects a list[str].

Before filing the PR, I checked the model BigModel and in particular the field profile_pics which is of type Annotated[list[UploadFile], FormFile(accept='image/*')] | None. However, there I did not receive a 422 error when providing only one file.

Copy link
Member

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

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

Thanks @schatimo, looks good now that we've added the test!

@sydney-runkle sydney-runkle merged commit fa88ab2 into pydantic:main May 30, 2024
16 checks passed
@schatimo schatimo deleted the fix_list_select branch August 24, 2024 16:59
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 with multi select fields
3 participants