-
Notifications
You must be signed in to change notification settings - Fork 59
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
File(allow_none=True) is not possible #319
Comments
I think adding |
An issue would be when you upload files using |
Oh, right, that's probably why @uncle-lv any thoughts on this? |
Yes, we have handled it. |
There is an interesting thing. If no file is uploaded, the content is empty:
If an empty file is uploaded(such as an empty text file), the content is also empty, but there is a filename:
It seems that we cannot judge whether a file is uploaded by content. |
If no I think we can handle it according to the following rules: |
@uncle-lv seems like a sensible proposal to me. is it straightforward to validate against |
No need to validate |
oh i see. that certainly makes it simpler then. PRs welcome! |
In the end-to-end case, it's difficult to whether determine the file is Browser(Firefox/Chrome) will send send empty data with empty
Swagger will send send empty data without
Axios will send a string with value "null" when the file field of
I have no idea to handle it.🤯 |
My idea was to use it on a REST API, so I only needed to support 1 way. Or you can support all ways if considering to be used from a browser. |
Hi team,
Is there interest in making
File(allow_none=True)
?This would allow to send
None
to file and it being validated as valid.The use case is to delete the file when editing a resource (set it to None to delete it).
I can make pull request.
The text was updated successfully, but these errors were encountered: