Comments (5)
The reason is if we don't select a file, swagger will send an empty value like this:
POST http://localhost:5000/images HTTP/1.1
Content-Type: multipart/form-data; boundary=---------------------------70636434840698183742419445910
-----------------------------70636434840698183742419445910
Content-Disposition: form-data; name="image"
-----------------------------70636434840698183742419445910--
Then apiflask get an empty string in the parameter image
, and send 422 response to the client because a ValidationError("Not a valid file.")
has occurred.
I‘m not sure if we should handle this case or it's a bug of swagger. @greyli
from apiflask.
After tests, it seems to be the default behavior of swagger(Not a bug). We should handle it ourselves.
from apiflask.
Because the File
field has been migrated to flask-marshmallow, I can't resolve it directly.
I’ll fix it and add tests after this pr is merged and released.
from apiflask.
@uncle-lv Thansk for the fast reaction and fix the bug.
Now it's working fine :)
from apiflask.
@uncle-lv Well done! Thank you for the fix.
from apiflask.
Related Issues (20)
- Add support for adding decorators to the OpenAPI spec and documentation UI endpoints HOT 8
- Deprecation warning with Flask 3.0 HOT 2
- Allow defining additional media types for a response
- `pagination_builder` data is not always compliant with PaginationSchema HOT 1
- Endpoints with authentication in debug mode HOT 1
- Support adding headers to the response schema HOT 2
- Support the OpenTelemetry into APIFlask
- OneOf, ContainsOnly for dataclass
- .
- Support Pydantic HOT 1
- Support `from apiflask import current_app` HOT 2
- `@app.error_processor` with specific errors HOT 2
- WebSocket support ?
- While handling marshmallow ValidationError containing other ValidationError(s), make_response fails HOT 5
- Re-use the File, Config field, and file-related validators from flask-marshmallow HOT 1
- `flask spec` command raises TypeError on decimal field validator
- Add support for a --quiet flag for the spec command HOT 2
- Can APIFlask support Quart? HOT 1
- Create Combo Box HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apiflask.