@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
64 lines (44 loc) • 1.79 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/strongloop/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`<!-- -->.
<b>Signature:</b>
```typescript
export declare function visibility(visibilityType: OperationVisibility): (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor<any> | undefined) => any;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| visibilityType | [OperationVisibility](./openapi-v3.operationvisibility.md) | |
<b>Returns:</b>
(target: any, method?: string \| undefined, methodDescriptor?: TypedPropertyDescriptor<any> \| undefined) => 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!'
}
}
```