loopbackio / loopback-next

LoopBack makes it easy to build modern API applications that require complex integrations.
https://loopback.io
Other
4.95k stars 1.06k forks source link

Application Config rest.openApiSpec disabled: true doesnt seem to work #9530

Open tokidoki11 opened 1 year ago

tokidoki11 commented 1 year ago

Describe the bug

Currently I set my config as this

const config = {
    rest: {
      port: +(process.env.PORT ?? 3000),
      host: process.env.HOST,
      // The `gracePeriodForClose` provides a graceful close for http/https
      // servers with keep-alive clients. The default value is `Infinity`
      // (don't force-close). If you want to immediately destroy all sockets
      // upon stop, set its value to `0`.
      // See https://www.npmjs.com/package/stoppable
      gracePeriodForClose: 5000, // 5 seconds
      openApiSpec: {
        // setServersFromRequest: process.env.NODE_ENV === 'development',
        disabled: true,
        // servers: [{url: 'https://mp.localhost/api'}],
      },
    },

endpoint to /api/explorer still accessible where it should not https://loopback.io/doc/en/lb4/Customizing-how-openapi-spec-is-served.html

Logs

No response

Additional information

No response

Reproduction

https://codesandbox.io/s/nostalgic-taussig-qgxc52

benjaminrae commented 1 year ago

See this

You need to either comment out or delete these lines in application.ts:

this.configure(RestExplorerBindings.COMPONENT).to({
      path: '/explorer',
    });
this.component(RestExplorerComponent);