From faa7940c515bbd65dfaf9370594794f627099a38 Mon Sep 17 00:00:00 2001 From: Simonas Karuzas Date: Tue, 9 Mar 2021 20:43:32 +0200 Subject: [PATCH] fix: open api schema x-methods (#414) --- packages/remote-client/src/openApi.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/remote-client/src/openApi.ts b/packages/remote-client/src/openApi.ts index aa03ae851..ae01be5b6 100644 --- a/packages/remote-client/src/openApi.ts +++ b/packages/remote-client/src/openApi.ts @@ -13,6 +13,7 @@ export const getOpenApiSchema = ( const paths: OpenAPIV3.PathsObject = {} const schemas = {} + const xMethods: Record = {} for (const method of exposedMethods) { const pathItemObject: OpenAPIV3.PathItemObject = { @@ -48,9 +49,10 @@ export const getOpenApiSchema = ( }, } paths[basePath + '/' + method] = pathItemObject + xMethods[method] = agentSchema.components.methods[method] } - const openApi: OpenAPIV3.Document = { + const openApi: OpenAPIV3.Document & {'x-methods'?: Record} = { openapi: '3.0.0', info: { title: name || 'DID Agent', @@ -62,10 +64,7 @@ export const getOpenApiSchema = ( paths, } - if (openApi.components?.schemas) { - //@ts-ignore - openApi['x-methods'] = agent.getSchema().components.methods - } + openApi['x-methods'] = xMethods return openApi }