Skip to content

Commit

Permalink
fix: Path parameters are not correctly overriden
Browse files Browse the repository at this point in the history
fixes #400
  • Loading branch information
RomanHotsiy committed Jan 21, 2018
1 parent e8adb60 commit c406dc5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/utils/spec-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ export class SpecManager {

let operationParamsPtr = JsonPointer.join(operationPtr, ['parameters']);
let operationParams:SwaggerParameter[] = this.byPointer(operationParamsPtr) || [];

const operationParamNames = {};
operationParams.forEach(param => operationParamNames[param.name] = true);

// filter out path params overriden by operation ones with the same name
pathParams = pathParams.filter(pathParam => !operationParamNames[pathParam.name]);
pathParams = injectPointers(pathParams, pathParamsPtr);
operationParams = injectPointers(operationParams, operationParamsPtr);

Expand Down

0 comments on commit c406dc5

Please sign in to comment.