From da787bcd2f9abd49dac83a07838211525338d6f5 Mon Sep 17 00:00:00 2001 From: Jonas Lagoni Date: Mon, 24 Jul 2023 13:24:08 +0200 Subject: [PATCH] Update src/third-version.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maciej UrbaƄczyk --- src/third-version.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/third-version.ts b/src/third-version.ts index 85273cd1..a03f4ca3 100644 --- a/src/third-version.ts +++ b/src/third-version.ts @@ -384,25 +384,25 @@ function convertParameters(parameters: Record): Record * Does not include extensions from schema. */ function convertParameter(parameter: any): any { + const ref = parameter['$ref'] ?? null; + if(ref !== null) { + return { + $ref: ref + } + } + const enumValues = parameter.schema?.enum ?? null; const defaultValues = parameter.schema?.default ?? null; const description = parameter.description ?? parameter.schema?.description ?? null; const examples = parameter.schema?.examples ?? null; const location = parameter.location ?? null; - const ref = parameter['$ref'] ?? null; //Make sure we keep parameter extensions - const v2ParameterObjectProperties = ["location", "schema", "description", "$ref"]; + const v2ParameterObjectProperties = ["location", "schema", "description"]; const v2ParameterObjectExtensions = Object.entries(parameter).filter(([key,]) => { return !v2ParameterObjectProperties.includes(key); }); - if(ref !== null) { - return { - $ref: ref - } - } - //Return the new v3 parameter object return Object.assign({...v2ParameterObjectExtensions}, enumValues === null ? null : {enum: enumValues},