@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
91 lines (55 loc) • 1.9 kB
Markdown
---
lang: en
title: 'API docs: openapi-v3.visibility'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/openapi-v3
permalink: /doc/en/lb4/apidocs.openapi-v3.visibility.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/openapi-v3](./openapi-v3.md) > [visibility](./openapi-v3.visibility.md)
## visibility() function
Marks an api path with the specfied visibility. When applied to a class, this decorator marks all paths with the specified visibility.
You can optionally mark all controllers in a class with `@visibility('undocumented')`<!-- -->, but use `@visibility('documented')` on a specific method to ensure it is not marked as `undocumented`<!-- -->.
**Signature:**
```typescript
export declare function visibility(visibilityType: OperationVisibility): (target: any, method?: string, methodDescriptor?: TypedPropertyDescriptor<any>) => any;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
visibilityType
</td><td markdown="1">
[OperationVisibility](./openapi-v3.operationvisibility.md)
</td><td markdown="1">
</td></tr>
</tbody></table>
**Returns:**
(target: any, method?: string, methodDescriptor?: TypedPropertyDescriptor<any>) => any
## Example
```ts
@oas.visibility('undocumented')
class MyController {
@get('/greet')
async function greet() {
return 'Hello, World!'
}
@get('/greet-v2')
@oas.deprecated('documented')
async function greetV2() {
return 'Hello, World!'
}
}
class MyOtherController {
@get('/echo')
async function echo() {
return 'Echo!'
}
}
```