@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
93 lines (56 loc) • 1.93 kB
Markdown
---
lang: en
title: 'API docs: openapi-v3.deprecated'
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.deprecated.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [/openapi-v3](./openapi-v3.md) > [deprecated](./openapi-v3.deprecated.md)
## deprecated() function
Marks an api path as deprecated. When applied to a class, this decorator marks all paths as deprecated.
You can optionally mark all controllers in a class as deprecated, but use `` on a specific method to ensure it is not marked as deprecated in the specification.
**Signature:**
```typescript
export declare function deprecated(isDeprecated?: boolean): (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">
isDeprecated
</td><td markdown="1">
boolean
</td><td markdown="1">
_(Optional)_ whether or not the path should be marked as deprecated. This is useful for marking a class as deprecated, but a method as not deprecated.
</td></tr>
</tbody></table>
**Returns:**
(target: any, method?: string, methodDescriptor?: TypedPropertyDescriptor<any>) => any
## Example
```ts
.deprecated()
class MyController {
public async function greet() {
return 'Hello, World!'
}
.deprecated(false)
public async function greetV2() {
return 'Hello, World!'
}
}
class MyOtherController {
public async function echo() {
return 'Echo!'
}
}
```