Skip to content

Commit

Permalink
fix: open api schema x-methods (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat authored Mar 9, 2021
1 parent ec3367d commit faa7940
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/remote-client/src/openApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const getOpenApiSchema = (
const paths: OpenAPIV3.PathsObject = {}

const schemas = {}
const xMethods: Record<string,any> = {}

for (const method of exposedMethods) {
const pathItemObject: OpenAPIV3.PathItemObject = {
Expand Down Expand Up @@ -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<string, any>} = {
openapi: '3.0.0',
info: {
title: name || 'DID Agent',
Expand All @@ -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
}

0 comments on commit faa7940

Please sign in to comment.