diff --git a/packages/shopping/src/application.ts b/packages/shopping/src/application.ts index 0a494c113..b5c1954ef 100644 --- a/packages/shopping/src/application.ts +++ b/packages/shopping/src/application.ts @@ -48,6 +48,13 @@ export class ShoppingApplication extends BootMixin( ) { constructor(options?: ApplicationConfig) { super(options); + this.api({ + openapi: '3.0.0', + info: {title: pkg.name, version: pkg.version}, + paths: {}, + components: {securitySchemas: SECURITY_SCHEMA_SPEC}, + security: SECURITY_SPEC, + }); this.setUpBindings(); @@ -103,14 +110,5 @@ export class ShoppingApplication extends BootMixin( async start(): Promise { await super.start(); - const oaiSpec = this.getSync(RestBindings.API_SPEC); - this.api( - Object.assign(oaiSpec, { - components: { - ...SECURITY_SCHEMA_SPEC, - }, - security: SECURITY_SPEC, - }), - ); } } diff --git a/packages/shopping/src/utils/security-spec.ts b/packages/shopping/src/utils/security-spec.ts index 50132f00f..e27baeea8 100644 --- a/packages/shopping/src/utils/security-spec.ts +++ b/packages/shopping/src/utils/security-spec.ts @@ -1,15 +1,13 @@ export const SECURITY_SPEC = [{bearerAuth: []}]; export const SECURITY_SPEC_OPERATION = [{basicAuth: []}]; export const SECURITY_SCHEMA_SPEC = { - securitySchemes: { - bearerAuth: { - type: 'http', - scheme: 'bearer', - bearerFormat: 'JWT', - }, - basicAuth: { - type: 'http', - scheme: 'basic', - }, + bearerAuth: { + type: 'http', + scheme: 'bearer', + bearerFormat: 'JWT', + }, + basicAuth: { + type: 'http', + scheme: 'basic', }, };