fastify / fastify/help

swagger with multiple requestBody

Open
#1,038 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
No language data
Stars
68
Forks
8
Avg merge
11h 2m
Merged PRs (30d)
2

Description

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

```yaml
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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.