Describe the bug
I have more than one 'x-webhooks' entries in swagger files. After compilation only one webhook remains in resulting JSON.
To Reproduce
Create swagger file with 2 or more 'x-webhhoks' sections
Run compilation
Check the 'x-webhooks' section in result JSON - it contains only latest webhook information
Expected behavior
'x-webhooks' section contains all the webhooks from source YAMLs.
Desktop:
MaOS 12.6
Node 18.0.0
swagger-jsdoc@6.2.5
Additional context
YAML example:
// wh-example.js
/**
* Example 1
*
* @swagger
* x-webhooks:
* newCat:
* post:
* description: Information about a new cat in the systems
* tags:
* - pet
* requestBody:
* content:
* application/json:
* schema:
* $ref: "#/components/schemas/Cat"
* responses:
* "200":
* description: Return a 200 status to indicate that the data was received successfully
*/
/**
* Example 2
*
* @swagger
* x-webhooks:
* newDog:
* post:
* description: Information about a new dog in the systems
* tags:
* - pet
* requestBody:
* content:
* application/json:
* schema:
* $ref: "#/components/schemas/Dog"
* responses:
* "200":
* description: Return a 200 status to indicate that the data was received successfully
*/
Executable code example:
// wh-compile.js
const swaggerJsDoc = require('swagger-jsdoc')
const result = swaggerJsDoc({
swaggerDefinition: {
info: {
title: 'Example with extensions',
version: '0.0.1'
}
},
apis: ['./wh-example.js']
})
console.assert(result['x-webhooks'].newCat, 'Cat is here')
console.assert(result['x-webhooks'].newDog, 'Dog is here')
console.log(result['x-webhooks'])
Command:
node wh-compile
Current result:
Assertion failed: Cat is here
{
newDog: {
post: {
description: 'Information about a new dog in the systems',
tags: [Array],
requestBody: [Object],
responses: [Object]
}
}
}
Expected result:
{
newCat: {
post: {
description: 'Information about a new cat in the systems',
tags: [Array],
requestBody: [Object],
responses: [Object]
}
},
newDog: {
post: {
description: 'Information about a new dog in the systems',
tags: [Array],
requestBody: [Object],
responses: [Object]
}
}
}
Describe the bug I have more than one 'x-webhooks' entries in swagger files. After compilation only one webhook remains in resulting JSON.
To Reproduce
Expected behavior 'x-webhooks' section contains all the webhooks from source YAMLs.
Desktop:
Additional context
YAML example:
Executable code example:
Command:
Current result:
Expected result:
Hints
Where the problem is: specification.js
How to fix it: