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
Show file upload for schema binary format #7325
Show file upload for schema binary format #7325
Conversation
@neiser Thanks for the PR! I think this solution is acceptable. I think we should also include a check for |
@tim-lai Thanks for your response. If we want to support I'm quite unexperienced in Swagger UI code base, but I'll see if I can manage to also write tests for it. I can't promise any timeline, so feel free to add it yourself if you find time. |
@neiser I believe SwaggerUI generally expects/handles files as |
66184ee
to
ffad1fa
Compare
According to swagger-api#7325 (comment) the uploaded file should be converted to base64 automatically.
@tim-lai I've added |
@tim-lai I've just added a cypress test verifying an upload button is displayed for the various options (either certain content types or schema formats). I didn't quite get your comment on Feel free to "edit" this PR and make corrections before merging. From my point of view, it should be done now. |
According to swagger-api#7325 (comment) the uploaded file should be converted to base64 automatically.
05612eb
to
e1aa12b
Compare
@neiser The Cypress tests captured what I was looking for... that the file upload button is displayed. Thanks for feature, test, and follow-up. PR is merged! |
When the spec has
format: binary
as the schema for a request body, the UI should show a file upload as it already does for some specific content types. This enables support for basically any type of content, see also discussion in #5636.Description
if
inrequest-body.jsx
Motivation and Context
Fixes #5636
How Has This Been Tested?
Tested locally with spec from #5636 (comment)
Screenshots (if appropriate):
File upload for application/zip:
Correct content type display (instead of hardcoded value):
Checklist
My PR contains...
My changes...
Documentation
Automated tests
Can you maybe add a little test case? I'm not really familiar with the code base. Feel free to add commits to that PR!