Adding descriptions as fallback in webhooks name, Avoid webhooks folder creation when there are not any webhook in the file and includeWebhooks is true, ignoring local and global servers in webhooks

This commit is contained in:
Erik Mendoza
2022-02-10 11:29:33 -06:00
parent 110b52cc68
commit 0aaa953e35
4 changed files with 5045 additions and 3 deletions

View File

@@ -660,6 +660,10 @@ module.exports = {
variableStore = {},
webhooksVariables = [];
if (Object.keys(webhooksTree.root.children).length === 0) {
return;
}
for (let child in webhooksTree.root.children) {
if (
webhooksTree.root.children.hasOwnProperty(child) &&
@@ -2232,10 +2236,10 @@ module.exports = {
pmBody,
authMeta,
swagResponse,
localServers = _.get(operationItem, 'properties.servers'),
localServers = fromWebhooks ? '' : _.get(operationItem, 'properties.servers'),
exampleRequestBody,
sanitizeResult,
globalServers = _.get(operationItem, 'servers'),
globalServers = fromWebhooks ? '' : _.get(operationItem, 'servers'),
responseMediaTypes,
acceptHeader;
@@ -2341,7 +2345,7 @@ module.exports = {
if (fromWebhooks) {
reqName = utils.insertSpacesInName(operation.operationId) ||
operation.summary ||
`${this.cleanWebhookName(operationItem.path)} - ${operationItem.method}`;
operation.description;
}
else {
reqName = operation.summary || utils.insertSpacesInName(operation.operationId) || reqUrl;