Skip to content
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

feat: allow a service to be marked as multipart #258

Closed
wants to merge 1 commit into from

Conversation

AshotN
Copy link
Contributor

@AshotN AshotN commented Jan 17, 2024

Summary

For services that accept file uploads, JSON is not the correct content type. This will allow the user to mark a service as a multipart service.

@Mairu
Copy link
Collaborator

Mairu commented Jan 17, 2024

Hi, thanks for the merge request.

But I don't know if this should be part of the library.

There are different ways to handle file uploads, the file could also be uploaded directly as described at OpenAPI File Uploads page.

Also, how you implemented, it would be an all-or-nothing setting. (all methods that support a request body and just another hard-coded content type)

It is a quite rare use case and if supported, there should also be support for file downloads and other content types.

I would prefer if there is documentation on how to handle such cases, but they should be defined manually.

docs: createSwaggerServiceOptions({
    schemas: { messageDataSchema, messageQuerySchema, messageSchema },
    docs: { 
      operations: {
        create: {
          'requestBody.content': {
            'multipart/form-data': {
              schema: {
                filename: {
                  type: 'string',
                  format: 'binary'
                }
              }
            }
          }
        }
      }
    }
  })

@AshotN AshotN closed this Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants