UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

63 lines (44 loc) 1.8 kB
--- 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) &gt; [@loopback/openapi-v3](./openapi-v3.md) &gt; [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 `@deprecated(false)` 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&lt;any&gt; \| undefined) =&gt; any ## Example ```ts @oas.deprecated() class MyController { @get('/greet') public async function greet() { return 'Hello, World!' } @get('/greet-v2') @oas.deprecated(false) public async function greetV2() { return 'Hello, World!' } } class MyOtherController { @get('/echo') public async function echo() { return 'Echo!' } } ```