Anto Hevin
Anto Hevin

Reputation: 23

Hide certain API endpoints from swagger LoopBack4

My application is made by the LoopBack4 framework. In this picture there are three API's are present. I want to use only the login API. So I don't want to visible /users API here. In LoopBack2 and LoopBack3 can do this but how can I hide this Users API from this swagger using LoopBack4.

Any code level configurations?

enter image description here

Upvotes: 1

Views: 927

Answers (1)

Rifa Achrinza
Rifa Achrinza

Reputation: 1585

LoopBack 4 will hide any Open API Spec 3.0 OperationObject that has x-visibility: undocumented.

This means that on a controller functions' operation decorator, you can write the following:

class UserController {
  @get('/users', {
    'x-visibility': 'undocumented',
    ...
  })
  async getUsers() {...}
}

Upvotes: 2

Related Questions