question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] There is no way to create swagger file upload

See original GitHub issue

Describe the bug As json takes a pynatic model and there is no Pyndatic field with type file I could not find a way to upload a file.

Does anybody know of a way to create a swagger file upload in Flask?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
kemingycommented, May 19, 2022

Are there some reasons for choosing to add both request.form or request.json in the same @api.validate(json=Schema)? Instead of declaring the two different schemas?

The request body can be either JSON data (maybe other serialized type) or a file.

There is a PR related to this:

This PR doesn’t have activities for a long time. Hope we can work together to improve it.

1reaction
gomeslucasmcommented, May 19, 2022

Interesting, maybe I can help you, I don’t have knowledge about starlette or falcon, but I can give you some ideas about the modifications that I made in the flask plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

File Upload - Swagger
Swagger 2.0 supports file upload requests with Content-Type: multipart/form-data , but does not care about the HTTP method. You can use POST, PUT...
Read more >
Missing file browser in "Try it out" for multipart/form file uploads
Following the docs on how to do such uploads in OpenAPI 3.0.0, however, I am missing that button in Swagger UI and see...
Read more >
swagger editor does not generate correct request for file upload
I am using Swagger editor to build a post request to upload a file. My swagger json file is defined as follows. ......
Read more >
File Upload via Swagger - codeburst
Many of us might have read the article “How to upload file via Swagger in ASP.NET Core Web API” by Talking Dotnet (link,...
Read more >
Problem uploading swagger/openapi file - Atlassian Community
2) If I use the curl command to upload the file it only seems to work if there is no openapi spec already...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found