From fe6909ed80dd6053b48c30f63a2460614bf957a9 Mon Sep 17 00:00:00 2001 From: Roman Marshevskyy Date: Mon, 11 Oct 2021 11:51:17 +0300 Subject: [PATCH] fix: OpenAPI 3.1: Missing description when $ref used #1727 --- src/services/OpenAPIParser.ts | 7 ------- src/services/models/MediaType.ts | 2 +- src/utils/openapi.ts | 4 ++-- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/services/OpenAPIParser.ts b/src/services/OpenAPIParser.ts index 1683e927..399ce1d5 100644 --- a/src/services/OpenAPIParser.ts +++ b/src/services/OpenAPIParser.ts @@ -206,13 +206,6 @@ export class OpenAPIParser { } } - shalowDeref(obj: OpenAPIRef | T): T { - if (this.isRef(obj)) { - return this.byRef(obj.$ref)!; - } - return obj; - } - /** * Merge allOf constraints. * @param schema schema with allOF diff --git a/src/services/models/MediaType.ts b/src/services/models/MediaType.ts index 9e41d89a..25dae807 100644 --- a/src/services/models/MediaType.ts +++ b/src/services/models/MediaType.ts @@ -40,7 +40,7 @@ export class MediaTypeModel { this.examples = { default: new ExampleModel( parser, - { value: parser.shalowDeref(info.example) }, + { value: parser.shallowDeref(info.example) }, name, info.encoding, ), diff --git a/src/utils/openapi.ts b/src/utils/openapi.ts index ad267722..d0b081f5 100644 --- a/src/utils/openapi.ts +++ b/src/utils/openapi.ts @@ -505,13 +505,13 @@ export function mergeParams( ): Array> { const operationParamNames = {}; operationParams.forEach(param => { - param = parser.shalowDeref(param); + param = parser.shallowDeref(param); operationParamNames[param.name + '_' + param.in] = true; }); // filter out path params overridden by operation ones with the same name pathParams = pathParams.filter(param => { - param = parser.shalowDeref(param); + param = parser.shallowDeref(param); return !operationParamNames[param.name + '_' + param.in]; });