From 4a39dccfd281adff3431bd275dd597face32e0ff Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Fri, 15 Jan 2021 12:46:58 -0800 Subject: [PATCH] OAI2-> OAI3: Fail if there is no produces provided for a path and the response has a schema/body (#144) --- .gitignore | 2 +- oai2-to-oai3/changelog.md | 3 ++ oai2-to-oai3/package.json | 2 +- oai2-to-oai3/src/content-type-utils.ts | 40 ++++++++++++++++++ oai2-to-oai3/src/converter.ts | 31 +++++++------- oai2-to-oai3/src/oai2/definition.ts | 33 +++++++++++++++ oai2-to-oai3/src/oai2/document.ts | 19 +++++++++ oai2-to-oai3/src/oai2/index.ts | 3 ++ oai2-to-oai3/src/oai2/paths.ts | 42 +++++++++++++++++++ .../src/runner/oai2-to-oai3-runner.ts | 3 +- oai2-to-oai3/src/runner/utils.ts | 3 +- .../conversion/oai2/exec-service.json | 23 +++++----- .../conversion/oai3/exec-service.json | 22 +++++----- oai2-to-oai3/test/test-conversion.ts | 37 ++++++++-------- 14 files changed, 202 insertions(+), 61 deletions(-) create mode 100644 oai2-to-oai3/src/content-type-utils.ts create mode 100644 oai2-to-oai3/src/oai2/definition.ts create mode 100644 oai2-to-oai3/src/oai2/document.ts create mode 100644 oai2-to-oai3/src/oai2/index.ts create mode 100644 oai2-to-oai3/src/oai2/paths.ts diff --git a/.gitignore b/.gitignore index 37b1a43..84d43f9 100644 --- a/.gitignore +++ b/.gitignore @@ -72,4 +72,4 @@ package-deps.json **/dist/* node_modules/* package-lock.json -common/config/rush/shrinkwrap.yaml +common/config/rush/pnpm-lock.yaml diff --git a/oai2-to-oai3/changelog.md b/oai2-to-oai3/changelog.md index 384b1d8..6436014 100644 --- a/oai2-to-oai3/changelog.md +++ b/oai2-to-oai3/changelog.md @@ -1,5 +1,8 @@ # Change Log - @azure-tools/oai2-to-oai3 +# 4.2.0 +- **fix**: Fail if a response has no produces defined and no global defined either [PR 144](https://github.com/Azure/perks/pull/144) + # 4.1.0 - **fix**: Issue with cross-file referneces of body parameters [PR 131](https://github.com/Azure/perks/pull/131) diff --git a/oai2-to-oai3/package.json b/oai2-to-oai3/package.json index 531d2d6..4d52904 100644 --- a/oai2-to-oai3/package.json +++ b/oai2-to-oai3/package.json @@ -1,6 +1,6 @@ { "name": "@azure-tools/oai2-to-oai3", - "version": "4.1.0", + "version": "4.2.0", "patchOffset": 100, "description": "OpenAPI2 to OpenAPI3 conversion library that maintains souremaps for use with AutoRest", "main": "./dist/src/index.js", diff --git a/oai2-to-oai3/src/content-type-utils.ts b/oai2-to-oai3/src/content-type-utils.ts new file mode 100644 index 0000000..6f49613 --- /dev/null +++ b/oai2-to-oai3/src/content-type-utils.ts @@ -0,0 +1,40 @@ +import { OpenAPI2Operation } from "./oai2"; + +/** + * Resolve the list of content types produced by an operation. + * @param operationProduces: List of content type produces by the operation. + * @param globalProduces: List of default content type produced by the API. + * @returns list of produced content types. Array will have at least one entry. + */ +export const resolveOperationProduces = ( + operation: OpenAPI2Operation, + globalProduces: string[], +): string[] => { + const operationProduces = operation.produces; + const produces = operationProduces + ? operationProduces.indexOf("application/json") !== -1 + ? operationProduces + : [...new Set([...operationProduces])] + : globalProduces; + + // default + if (produces.length === 0) { + produces.push("*/*"); + } + + return produces; +}; + +/** + * Resolve the list of content types consumed by an operation. + * @param operationConsumes: List of content type consumed by the operation. + * @param globalConsumes: List of default content type consumed by the API. + */ +export const resolveOperationConsumes = (operation: OpenAPI2Operation, globalConsumes: string[]): string[] => { + const operationConsumes = operation.consumes; + return operationConsumes + ? operationConsumes.indexOf("application/octet-stream") !== -1 + ? operationConsumes + : [...new Set([...operationConsumes])] + : globalConsumes; +}; diff --git a/oai2-to-oai3/src/converter.ts b/oai2-to-oai3/src/converter.ts index 47712c7..42b07bb 100644 --- a/oai2-to-oai3/src/converter.ts +++ b/oai2-to-oai3/src/converter.ts @@ -1,5 +1,7 @@ import { createGraphProxy, JsonPointer, Node, visit, get } from '@azure-tools/datastore'; import { Mapping } from 'source-map'; +import { resolveOperationConsumes, resolveOperationProduces } from './content-type-utils'; +import { OpenAPI2Document, OpenAPI2Header, OpenAPI2Operation, OpenAPI2OperationResponse } from './oai2'; import { cleanElementName, convertOai2RefToOai3, parseOai2Ref } from './refs-utils'; import { ResolveReferenceFn } from './runner'; import { statusCodes } from './status-codes'; @@ -11,7 +13,7 @@ export class Oai2ToOai3 { public mappings = new Array(); - constructor(protected originalFilename: string, protected original: any, private resolveExternalReference?: ResolveReferenceFn) { + constructor(protected originalFilename: string, protected original: OpenAPI2Document, private resolveExternalReference?: ResolveReferenceFn) { this.generated = createGraphProxy(this.originalFilename, '', this.mappings); } @@ -697,7 +699,7 @@ export class Oai2ToOai3 { } } - async visitOperation(pathItem: any, httpMethod: string, jsonPointer: JsonPointer, operationItemMembers: Iterable, operationValue: any, globalConsumes: Array, globalProduces: Array) { + async visitOperation(pathItem: any, httpMethod: string, jsonPointer: JsonPointer, operationItemMembers: Iterable, operationValue: OpenAPI2Operation, globalConsumes: Array, globalProduces: Array) { // trace was not supported on OpenAPI 2.0, it was an extension httpMethod = (httpMethod !== 'x-trace') ? httpMethod : 'trace'; @@ -707,20 +709,9 @@ export class Oai2ToOai3 { const operation = pathItem[httpMethod]; // preprocess produces and consumes for responses and parameters respectively; - const produces = (operationValue.produces) ? - (operationValue.produces.indexOf('application/json') !== -1) ? - operationValue.produces : - [...new Set([...operationValue.produces])] : - globalProduces; - - // default - if (produces.length === 0) { - produces.push('*/*'); - } + const produces = resolveOperationProduces(operationValue, globalProduces); + const consumes = resolveOperationConsumes(operationValue, globalConsumes); - const consumes = (operationValue.consumes) ? (operationValue.consumes.indexOf('application/octet-stream') !== -1) ? operationValue.consumes - : [...new Set([...operationValue.consumes])] - : globalConsumes; for (const { value, key, pointer, children: operationFieldItemMembers } of operationItemMembers) { switch (key) { case 'tags': @@ -1055,7 +1046,7 @@ export class Oai2ToOai3 { } } - async visitResponse(responseTarget: any, responseValue: any, responseName: string, responsesFieldMembers: () => Iterable, jsonPointer: string, produces: Array) { + async visitResponse(responseTarget: any, responseValue: OpenAPI2OperationResponse, responseName: string, responsesFieldMembers: () => Iterable, jsonPointer: string, produces: Array) { // NOTE: The previous converter patches the description of the response because // every response should have a description. @@ -1071,6 +1062,12 @@ export class Oai2ToOai3 { } if (responseValue.schema) { + if (produces.length === 0 || (produces.length === 1 && produces[0] === "*/*")) { + throw new Error( + `Operation response '${jsonPointer}' produces type couldn't be resolved. Operation is probably is missing a produces field and there isn't any global value. Please add "produces": []"`, + ); + } + responseTarget.content = this.newObject(jsonPointer); for (const mimetype of produces) { responseTarget.content[mimetype] = this.newObject(jsonPointer); @@ -1151,7 +1148,7 @@ export class Oai2ToOai3 { 'uniqueItems' ]; - async visitHeader(targetHeader: any, headerValue: any, jsonPointer: string) { + async visitHeader(targetHeader: any, headerValue: OpenAPI2Header, jsonPointer: string) { if (headerValue.$ref) { targetHeader.$ref = { value: this.convertReferenceToOai3(headerValue.schema.$ref), pointer: jsonPointer }; } else { diff --git a/oai2-to-oai3/src/oai2/definition.ts b/oai2-to-oai3/src/oai2/definition.ts new file mode 100644 index 0000000..c55e388 --- /dev/null +++ b/oai2-to-oai3/src/oai2/definition.ts @@ -0,0 +1,33 @@ +export interface OpenAPI2Definition { + [key: string]: unknown; + + additionalProperties?: OpenAPI2Definition | OpenAPI2Reference | boolean; + allOf?: OpenAPI2Definition[]; + description?: string; + enum?: string[]; + format?: string; + items?: OpenAPI2Definition | OpenAPI2Reference; + oneOf?: (OpenAPI2Definition | OpenAPI2Reference)[]; + properties?: { [index: string]: OpenAPI2Definition | OpenAPI2Reference }; + required?: string[]; + title?: string; + type?: OpenAPI2Type; // allow this to be optional to cover cases when this is missing +} + +export interface OpenAPI2Reference { + $ref: string; +} + +export type OpenAPI2Type = + | "array" + | "boolean" + | "byte" + | "date" + | "dateTime" + | "double" + | "float" + | "integer" + | "long" + | "number" + | "object" + | "string"; diff --git a/oai2-to-oai3/src/oai2/document.ts b/oai2-to-oai3/src/oai2/document.ts new file mode 100644 index 0000000..1283016 --- /dev/null +++ b/oai2-to-oai3/src/oai2/document.ts @@ -0,0 +1,19 @@ +import { OpenAPI2Definition } from "./definition"; +import { OpenAPI2Path } from "./paths"; + +export interface OpenAPI2Document { + swagger: "2.0"; + produces?: string[]; + consumes?: string[]; + schemes?: string[]; + host?: string; + basePath?: string; + paths: { [path: string]: OpenAPI2Path }; + definitions: { [name: string]: OpenAPI2Definition }; +} + +export interface OpenAPI2DocumentInfo { + title: string; + description: string; + version: string; +} diff --git a/oai2-to-oai3/src/oai2/index.ts b/oai2-to-oai3/src/oai2/index.ts new file mode 100644 index 0000000..11d4b10 --- /dev/null +++ b/oai2-to-oai3/src/oai2/index.ts @@ -0,0 +1,3 @@ +export * from "./document"; +export * from "./paths"; +export * from "./definition"; \ No newline at end of file diff --git a/oai2-to-oai3/src/oai2/paths.ts b/oai2-to-oai3/src/oai2/paths.ts new file mode 100644 index 0000000..ac6585c --- /dev/null +++ b/oai2-to-oai3/src/oai2/paths.ts @@ -0,0 +1,42 @@ +import { OpenAPI2Definition, OpenAPI2Reference } from "./definition"; + +/** + * Custom http method verb for autorest. + */ +export type HttpMethodCustom = "x-trace"; + +export type HttpMethod = "get" | "post" | "patch" | "put" | "delete" | "options" | "head" | "trace"; + +export type OpenAPI2Path = { + [method in HttpMethod]: OpenAPI2Path; +} & { + parameters: any[]; +}; + +export interface OpenAPI2Operation { + operationId: string; + description: string; + responses: OpenAPI2OperationResponses; + parameters?: any[]; + produces?: string[]; + consumes?: string[]; +} + +export type OpenAPI2OperationResponses = { [statusCode: string]: OpenAPI2OperationResponse }; + +export interface OpenAPI2OperationResponse { + description: string; + schema?: OpenAPI2Definition; + examples?: { [exampleName: string]: unknown }; + headers?: { [headerName: string]: OpenAPI2Header }; +} + +export type OpenAPI2Header = OpenAPI2Reference & OpenAPI2HeaderDefinition; + +export interface OpenAPI2HeaderDefinition { + type: "string" | "number" | "integer" | "boolean" | "array"; + schema: OpenAPI2Reference & OpenAPI2Definition; + description: string; + items: any; + collectionFormat: "csv" | "ssv" | "tsv" | "pipes" | "multi"; +} \ No newline at end of file diff --git a/oai2-to-oai3/src/runner/oai2-to-oai3-runner.ts b/oai2-to-oai3/src/runner/oai2-to-oai3-runner.ts index c95641b..19f4d8b 100644 --- a/oai2-to-oai3/src/runner/oai2-to-oai3-runner.ts +++ b/oai2-to-oai3/src/runner/oai2-to-oai3-runner.ts @@ -1,10 +1,11 @@ import { DataHandle, get } from "@azure-tools/datastore"; import { Oai2ToOai3 } from "../converter"; +import { OpenAPI2Document } from "../oai2"; import { loadInputFiles } from "./utils"; export interface OaiToOai3FileInput { name: string; - schema: any; // OAI2 type? + schema: OpenAPI2Document; // OAI2 type? } export interface OaiToOai3FileOutput { diff --git a/oai2-to-oai3/src/runner/utils.ts b/oai2-to-oai3/src/runner/utils.ts index 7f65188..bd52c67 100644 --- a/oai2-to-oai3/src/runner/utils.ts +++ b/oai2-to-oai3/src/runner/utils.ts @@ -1,10 +1,11 @@ import { DataHandle } from '@azure-tools/datastore'; +import { OpenAPI2Document } from '../oai2'; import { OaiToOai3FileInput } from './oai2-to-oai3-runner'; export const loadInputFiles = async (inputFiles: DataHandle[]): Promise => { const inputs: OaiToOai3FileInput[] = []; for (const file of inputFiles) { - const schema = await file.ReadObject(); + const schema = await file.ReadObject(); inputs.push({ name: file.originalFullPath, schema }); } return inputs; diff --git a/oai2-to-oai3/test/resources/conversion/oai2/exec-service.json b/oai2-to-oai3/test/resources/conversion/oai2/exec-service.json index db8df66..43319a3 100644 --- a/oai2-to-oai3/test/resources/conversion/oai2/exec-service.json +++ b/oai2-to-oai3/test/resources/conversion/oai2/exec-service.json @@ -5,6 +5,7 @@ "title": "ExecService", "description": "Azure Dev Spaces ExecService v3.2" }, + "paths": { "/api/v3.2/AzdsTraces": { "post": { @@ -13,7 +14,7 @@ ], "operationId": "AzdsTraces_PostAzdsUserClusterLogsAsync", "consumes": [], - "produces": [], + "produces": ["application/json"], "parameters": [ { "name": "onbehalfof", @@ -54,7 +55,7 @@ "text/json", "application/*+json" ], - "produces": [], + "produces": ["application/json"], "parameters": [ { "name": "spaceName", @@ -151,7 +152,7 @@ ], "operationId": "Liveness_LivenessCheck", "consumes": [], - "produces": [], + "produces": ["application/json"], "parameters": [], "responses": { "200": { @@ -173,7 +174,7 @@ ], "operationId": "Ping_CheckUserAuth", "consumes": [], - "produces": [], + "produces": ["application/json"], "parameters": [], "responses": { "200": { @@ -201,7 +202,7 @@ ], "operationId": "Ping_CheckWhitelistAndUserAuth", "consumes": [], - "produces": [], + "produces": ["application/json"], "parameters": [], "responses": { "200": { @@ -229,7 +230,7 @@ ], "operationId": "Ping_CheckWhitelistOnlyAuth", "consumes": [], - "produces": [], + "produces": ["application/json"], "parameters": [], "responses": { "200": { @@ -286,7 +287,7 @@ ], "operationId": "Spaces_CreateSpace", "consumes": [], - "produces": [], + "produces": ["application/json"], "parameters": [ { "name": "spaceName", @@ -325,7 +326,7 @@ ], "operationId": "Spaces_DeleteSpace", "consumes": [], - "produces": [], + "produces": ["application/json"], "parameters": [ { "name": "spaceName", @@ -374,7 +375,7 @@ ], "operationId": "Spaces_CreateSpaceFromNamespace", "consumes": [], - "produces": [], + "produces": ["application/json"], "parameters": [ { "name": "namespaceName", @@ -454,7 +455,7 @@ ], "operationId": "Traces_ReportRequestAsync", "consumes": [], - "produces": [], + "produces": ["application/json"], "parameters": [], "responses": { "200": { @@ -482,7 +483,7 @@ ], "operationId": "Traces_ReportResponseAsync", "consumes": [], - "produces": [], + "produces": ["application/json"], "parameters": [], "responses": { "200": { diff --git a/oai2-to-oai3/test/resources/conversion/oai3/exec-service.json b/oai2-to-oai3/test/resources/conversion/oai3/exec-service.json index 77b9903..83d9446 100644 --- a/oai2-to-oai3/test/resources/conversion/oai3/exec-service.json +++ b/oai2-to-oai3/test/resources/conversion/oai3/exec-service.json @@ -37,7 +37,7 @@ "default": { "description": "Error response describing the reason for operation failure. The request failed. Bad request.", "content": { - "*/*": { + "application/json": { "schema": { "$ref": "#/components/schemas/ExecServiceErrorResponse" } @@ -92,7 +92,7 @@ "default": { "description": "Error response describing the reason for operation failure. The request failed. Bad request.", "content": { - "*/*": { + "application/json": { "schema": { "$ref": "#/components/schemas/ExecServiceErrorResponse" } @@ -207,7 +207,7 @@ "default": { "description": "Error response describing the reason for operation failure. The service has run out of storage space", "content": { - "*/*": { + "application/json": { "schema": { "$ref": "#/components/schemas/ExecServiceErrorResponse" } @@ -236,7 +236,7 @@ "default": { "description": "Error response describing the reason for operation failure.", "content": { - "*/*": { + "application/json": { "schema": { "$ref": "#/components/schemas/ExecServiceErrorResponse" } @@ -265,7 +265,7 @@ "default": { "description": "Error response describing the reason for operation failure.", "content": { - "*/*": { + "application/json": { "schema": { "$ref": "#/components/schemas/ExecServiceErrorResponse" } @@ -294,7 +294,7 @@ "default": { "description": "Error response describing the reason for operation failure.", "content": { - "*/*": { + "application/json": { "schema": { "$ref": "#/components/schemas/ExecServiceErrorResponse" } @@ -391,7 +391,7 @@ "default": { "description": "Error response describing the reason for operation failure. The request failed. Space name is invalid.", "content": { - "*/*": { + "application/json": { "schema": { "$ref": "#/components/schemas/ExecServiceErrorResponse" } @@ -446,7 +446,7 @@ "default": { "description": "Error response describing the reason for operation failure. The request failed. Specified space cannot be deleted.", "content": { - "*/*": { + "application/json": { "schema": { "$ref": "#/components/schemas/ExecServiceErrorResponse" } @@ -493,7 +493,7 @@ "default": { "description": "Error response describing the reason for operation failure. The request failed. Bad request.", "content": { - "*/*": { + "application/json": { "schema": { "$ref": "#/components/schemas/ExecServiceErrorResponse" } @@ -590,7 +590,7 @@ "default": { "description": "Error response describing the reason for operation failure.", "content": { - "*/*": { + "application/json": { "schema": { "$ref": "#/components/schemas/ExecServiceErrorResponse" } @@ -619,7 +619,7 @@ "default": { "description": "Error response describing the reason for operation failure.", "content": { - "*/*": { + "application/json": { "schema": { "$ref": "#/components/schemas/ExecServiceErrorResponse" } diff --git a/oai2-to-oai3/test/test-conversion.ts b/oai2-to-oai3/test/test-conversion.ts index 5173431..e038183 100644 --- a/oai2-to-oai3/test/test-conversion.ts +++ b/oai2-to-oai3/test/test-conversion.ts @@ -9,6 +9,7 @@ import { FastStringify } from '@azure-tools/datastore'; require('source-map-support').install(); import { Oai2ToOai3 } from '../src/converter'; +import { OpenAPI2Document } from '../src/oai2'; @suite class MyTests { @@ -32,7 +33,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -66,7 +67,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -100,7 +101,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -134,7 +135,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -168,7 +169,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -199,7 +200,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -230,7 +231,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -261,7 +262,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -292,7 +293,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -323,7 +324,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -355,7 +356,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -387,7 +388,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -419,7 +420,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -450,7 +451,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -480,7 +481,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -511,7 +512,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -542,7 +543,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(originalDataHandle != null); if (swaggerDataHandle && originalDataHandle) { - const swag = await swaggerDataHandle.ReadObject(); + const swag = await swaggerDataHandle.ReadObject(); const original = await originalDataHandle.ReadObject(); const convert = new Oai2ToOai3(swaggerUri, swag); @@ -579,7 +580,7 @@ import { Oai2ToOai3 } from '../src/converter'; assert(swaggerdata != null); if (swaggerdata) { - const swag = swaggerdata.ReadObject(); + const swag = await swaggerdata.ReadObject(); const convert = new Oai2ToOai3(swaggerdata.key, swag); const result = await convert.convert();