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

swagger with multiple requestBody #1038

Open
pkpritam3 opened this issue Jul 9, 2024 · 0 comments
Open

swagger with multiple requestBody #1038

pkpritam3 opened this issue Jul 9, 2024 · 0 comments
Labels
question Further information is requested

Comments

@pkpritam3
Copy link

pkpritam3 commented Jul 9, 2024

How can I implement below using fastify-swagger where we have multiple requestBody contents?

openapi: 3.0.1
info:
  title: Test API
  description: API documentation
  version: 1.0.0
paths:
  /your-endpoint:
    post:
      summary: Endpoint to handle multiple content types
      tags:
        - test
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                key:
                  type: string
              required:
                - key
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
              required:
                - file
          text/plain:
            schema:
              type: string
      responses:
        '200':
          description: Successful response
          content:
            application/hal+json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: object
                    additionalProperties: true
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Unsupported content type
@dosubot dosubot bot added the question Further information is requested label Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant