From 14f8408e8d3a0e1e72786e3875c17be77aca8426 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Thu, 7 Dec 2017 17:16:47 +0200 Subject: [PATCH] fix: do not ignore path level parameters --- demo/openapi.yaml | 2 +- src/services/MenuBuilder.ts | 4 ++-- src/services/models/Operation.ts | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/demo/openapi.yaml b/demo/openapi.yaml index 39f41989af..ea793436d9 100644 --- a/demo/openapi.yaml +++ b/demo/openapi.yaml @@ -102,7 +102,7 @@ x-tagGroups: paths: /pet: parameters: - - name: pathParam + - name: cookieParam in: cookie description: Some cookie required: true diff --git a/src/services/MenuBuilder.ts b/src/services/MenuBuilder.ts index c6d7337a05..db6cd576bd 100644 --- a/src/services/MenuBuilder.ts +++ b/src/services/MenuBuilder.ts @@ -13,7 +13,7 @@ export type TagInfo = OpenAPITag & { export type ExtendedOpenAPIOperation = { _$ref: string; httpVerb: string; - pathParams: Referenced[]; + pathParameters: Referenced[]; } & OpenAPIOperation; export type TagsInfoMap = Dict; @@ -193,7 +193,7 @@ export class MenuBuilder { ...operationInfo, _$ref: operationPointer, httpVerb: operationName, - pathParams: path.parameters || [], + pathParameters: path.parameters || [], }); } } diff --git a/src/services/models/Operation.ts b/src/services/models/Operation.ts index e2dd6fe6ea..a41a5f8f93 100644 --- a/src/services/models/Operation.ts +++ b/src/services/models/Operation.ts @@ -75,9 +75,9 @@ export class OperationModel implements IMenuItem { this.codeSamples = operationSpec['x-code-samples'] || []; this.path = JsonPointer.baseName(this._$ref, 2); - this.parameters = (operationSpec.parameters || []).map( - paramOrRef => new FieldModel(parser, paramOrRef, this._$ref, options), - ); + this.parameters = operationSpec.pathParameters + .concat(operationSpec.parameters || []) + .map(paramOrRef => new FieldModel(parser, paramOrRef, this._$ref, options)); let hasSuccessResponses = false; this.responses = Object.keys(operationSpec.responses || [])