fastify-swagger icon indicating copy to clipboard operation
fastify-swagger copied to clipboard

Enhance fileupload UI for multipart/form-data

Open imjuni opened this issue 3 years ago • 1 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

As a first, Great thank you for good tools. I suggest to enhance swagger ui for fileupload. Recently OpenAPI 3.0 support filpupload widget below,

filewidget

from: https://swagger.io/docs/specification/describing-request-body/file-upload/

But I cannot found documentation that display fileupload widget on @fastify/multipart and @fastify/swagger.

So I test 4 way of usage.

Expectation

I think that display fileupload widget and validate using by sharedSchemaId in @fastify/multipart. Or I want to know best practice for file upload and swagger.

Environment

Package Version
@fastify/multipart ^7.1.2
@fastify/swagger ^7.5.1
fastify ^4.5.3
fastify-plugin ^4.2.1
ajv ^8.11.0
ajv-formats ^2.1.1
node 16.17.0
npm 8.15.0
os win32, macOSX

Motivation

Better develop experience provide to co-worker or consumer.

Example

I upload sample project my repo.

  1. Checkout feature/fileupload
  2. Install package: npm install
  3. Run development server: npm run dev
  4. open url on browser: http://localhost:17878

Finally you can see like that: swagger_fileupload_widget02

imjuni avatar Sep 13 '22 12:09 imjuni

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

mcollina avatar Sep 13 '22 14:09 mcollina