fix: Path parameters are not correctly overriden

fixes #400
This commit is contained in:
Roman Hotsiy 2018-01-21 21:22:32 +02:00
parent e8adb605c3
commit c406dc5409
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -163,6 +163,12 @@ export class SpecManager {
let operationParamsPtr = JsonPointer.join(operationPtr, ['parameters']); let operationParamsPtr = JsonPointer.join(operationPtr, ['parameters']);
let operationParams:SwaggerParameter[] = this.byPointer(operationParamsPtr) || []; 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); pathParams = injectPointers(pathParams, pathParamsPtr);
operationParams = injectPointers(operationParams, operationParamsPtr); operationParams = injectPointers(operationParams, operationParamsPtr);