Skip to content

Commit 319090c

Browse files
committed
check we're actually dealing with a path type
1 parent 128a011 commit 319090c

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/definitionGenerator.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

0 commit comments

Comments
 (0)