loopbackio / loopbackio/loopback-next

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

Open
#9,530 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the REST application configuration shown in the issue and compare the documented rest.openApiSpec.disabled behavior with the /api/explorer endpoint. Reproduce the problem using the linked CodeSandbox and consult the linked OpenAPI serving documentation. Done means disabling the setting makes /api/explorer inaccessible as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.