@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
63 lines (44 loc) • 1.8 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.
<b>Signature:</b>
```typescript
export declare function deprecated(isDeprecated?: boolean): (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor<any> | undefined) => any;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| isDeprecated | boolean | 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. |
<b>Returns:</b>
(target: any, method?: string \| undefined, methodDescriptor?: TypedPropertyDescriptor<any> \| undefined) => 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!'
}
}
```