Skip to content

Commit 2ce3310

Browse files
authored
Merge pull request #148 from JaredCE/fix-cleanup-links
Fix cleanup links
2 parents fd7f175 + 7740611 commit 2ce3310

File tree

5 files changed

+23
-19
lines changed

5 files changed

+23
-19
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ Options:
9696
| tags[].externalDocs.url | custom.documentation.tags.externalDocumentation.url |
9797
| tags[].externalDocs.description | custom.documentation.tags.externalDocumentation.description |
9898
| path[path] | functions.functions.events.[http OR httpApi].path |
99-
| path[path].summary | functions.functions.summary |
100-
| path[path].description | functions.functions.description |
10199
| path[path].servers[].description | functions.functions.servers.description |
102100
| path[path].servers[].url | functions.functions.servers.url |
103101
| path[path].[operation] | functions.functions.[http OR httpApi].method |

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "serverless-openapi-documenter",
3-
"version": "0.0.82",
3+
"version": "0.0.83",
44
"description": "Generate OpenAPI v3 documentation and Postman Collections from your Serverless Config",
55
"main": "index.js",
66
"keywords": [

src/definitionGenerator.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ class DefinitionGenerator {
179179
throw err;
180180
});
181181

182-
if (httpFunction.functionInfo?.summary)
183-
path.summary = httpFunction.functionInfo.summary;
182+
// if (httpFunction.functionInfo?.summary)
183+
// path.summary = httpFunction.functionInfo.summary;
184184

185-
if (httpFunction.functionInfo?.description)
186-
path.description = httpFunction.functionInfo.description;
185+
// if (httpFunction.functionInfo?.description)
186+
// path.description = httpFunction.functionInfo.description;
187187

188188
if (httpFunction.functionInfo?.servers) {
189189
const servers = this.createServers(
@@ -910,16 +910,20 @@ class DefinitionGenerator {
910910
cleanupLinks() {
911911
for (const path of Object.keys(this.openAPI.paths)) {
912912
for (const [name, value] of Object.entries(this.openAPI.paths[path])) {
913-
for (const [statusCode, responseObj] of Object.entries(
914-
value.responses
915-
)) {
916-
if (responseObj.links) {
917-
for (const [linkName, linkObj] of Object.entries(
918-
responseObj.links
919-
)) {
920-
const opId = linkObj.operationId;
921-
if (this.functionMap[opId]) {
922-
linkObj.operationId = this.functionMap[opId][0];
913+
if (
914+
RegExp(/(get|put|post|delete|options|head|patch|trace)/i).test(name)
915+
) {
916+
for (const [statusCode, responseObj] of Object.entries(
917+
value?.responses
918+
)) {
919+
if (responseObj.links) {
920+
for (const [linkName, linkObj] of Object.entries(
921+
responseObj.links
922+
)) {
923+
const opId = linkObj.operationId;
924+
if (this.functionMap[opId]) {
925+
linkObj.operationId = this.functionMap[opId][0];
926+
}
923927
}
924928
}
925929
}

test/serverless-tests/best/serverless.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ custom:
9696
functions:
9797
getContent:
9898
handler: handler.getContent
99+
description: this is the overarching paths description for the following paths
100+
summary: overarching paths for getContent
99101
events:
100102
- httpApi:
101103
path: /{contentId}

0 commit comments

Comments
 (0)