Skip to main content

Request Body

Use the #swagger.requestBody to impletent Request Body.

Example #1
app.post('/path', (req, res) => {
...
/* #swagger.requestBody = {
required: true,
content: {
"application/json": {
schema: {
$ref: "#/components/schemas/someSchema"
}
}
}
}
*/
...
});
Example #2 (without declaring the content)
app.post('/path', (req, res) => {
...
/* #swagger.requestBody = {
required: true,
schema: { $ref: "#/components/schemas/someSchema" }
} */
...
});

NOTE: The body content in the Example #2 will be generated automatically with application/json and application/xml.