ts-spec / tspec

Type-driven API Documentation library. Auto-generating REST API document based on TypeScript types.
https://ts-spec.github.io/tspec/
MIT License
108 stars 5 forks source link

Question: how to upload multiple files?? #49

Closed Junguya closed 1 month ago

Junguya commented 2 months ago

image

I want to upload multiple files, not one file. Please tell me how.

image I want to come into Swagger like this

hyeonss0417 commented 1 month ago

Hello, Junguya.

Thank you very much for your interest in our project. We have reviewed the issue you reported regarding Multiple File Upload, and we have implemented Tspec.BinaryStringArray util type for support it. To use this feature on your end, please update tspec version to latest(=v0.1.114).

You can use Tspec.BinaryStringArray as follows.

export type FileApiSpec = Tspec.DefineApiSpec<{
  paths: {
    '/files/multiple-upload': {
      post: {
        summary: 'Upload Files',
        /** @mediaType multipart/form-data */
        body: {
          files: Tspec.BinaryStringArray;
        },
        responses: { 200: { fileNames: string[] } },
      },
    },
  },
}>;

Once again, thank you for your valuable feedback. Your contributions help us improve the project significantly.

Best regards, Hyeonsoneg Jeon.

Junguya commented 1 month ago

Thanks to you, I was able to upload multiple files.!