Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new decorator @visibility('undocumented') #6392

Closed
bajtos opened this issue Sep 18, 2020 · 2 comments · Fixed by #6414
Closed

Add a new decorator @visibility('undocumented') #6392

bajtos opened this issue Sep 18, 2020 · 2 comments · Fixed by #6414
Assignees
Labels
developer-experience Issues affecting ease of use and overall experience of LB users feature good first issue OpenAPI

Comments

@bajtos
Copy link
Member

bajtos commented Sep 18, 2020

#1896 added support for a LoopBack-specific OpenAPI metadata allowing API developers to hide an endpoint (an OpenAPI operation) from the spec generated by the server.

{
  "x-visibility": "undocumented"
}

At the moment, developers must use @operation decorator to provide this metadata, decorators like @get and @post cannot be used.

Let's implement a new decorator @visibility to make it easier to add x-visibility metadata to controller methods.

Example use:

class MyController {
  @get('/')
  @visibility('undocumented')
  index() {
     return '<html>Undocumented internal endpoint.</html>';
  }
}
@bajtos bajtos added developer-experience Issues affecting ease of use and overall experience of LB users feature OpenAPI good first issue labels Sep 18, 2020
@achrinza
Copy link
Member

Let's implement a new decorator @visibility to make it easier to add x-visibility metadata to controller methods.

+1 for adding the decorator. It helps abstract OAS 3 away from the developer, thereby making it more discoverable and more "natural" to implement. Let's make the decorator applicable at the controller level too, similar to existing OAS decorators.

At the moment, developers must use @operation decorator to provide this metadata, decorators like @get and @post cannot be used.

The documentation states otherwise:

image

@achrinza achrinza self-assigned this Sep 21, 2020
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Sep 21, 2020
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Sep 21, 2020
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Sep 21, 2020
@bajtos
Copy link
Member Author

bajtos commented Sep 21, 2020

+1 for adding the decorator. It helps abstract OAS 3 away from the developer, thereby making it more discoverable and more "natural" to implement. Let's make the decorator applicable at the controller level too, similar to existing OAS decorators.

+1

At the moment, developers must use @operation decorator to provide this metadata, decorators like @get and @post cannot be used.

The documentation states otherwise:

Ah, my bad, thank you @achrinza for correcting my mistake!

achrinza added a commit to achrinzafork/loopback-next that referenced this issue Sep 29, 2020
closes loopbackio#6392

Co-authored-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Rifa Achrinza <[email protected]>
raymondfeng pushed a commit that referenced this issue Oct 6, 2020
closes #6392

Co-authored-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Rifa Achrinza <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer-experience Issues affecting ease of use and overall experience of LB users feature good first issue OpenAPI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants