Skip to content

Commit c406dc5

Browse files
committed
fix: Path parameters are not correctly overriden
fixes #400
1 parent e8adb60 commit c406dc5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/utils/spec-manager.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ export class SpecManager {
163163

164164
let operationParamsPtr = JsonPointer.join(operationPtr, ['parameters']);
165165
let operationParams:SwaggerParameter[] = this.byPointer(operationParamsPtr) || [];
166+
167+
const operationParamNames = {};
168+
operationParams.forEach(param => operationParamNames[param.name] = true);
169+
170+
// filter out path params overriden by operation ones with the same name
171+
pathParams = pathParams.filter(pathParam => !operationParamNames[pathParam.name]);
166172
pathParams = injectPointers(pathParams, pathParamsPtr);
167173
operationParams = injectPointers(operationParams, operationParamsPtr);
168174

0 commit comments

Comments
 (0)