UNPKG

@loopback/docs

Version:

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

99 lines (62 loc) 1.72 kB
--- lang: en title: 'API docs: openapi-v3.tags' 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.tags.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/openapi-v3](./openapi-v3.md) &gt; [tags](./openapi-v3.tags.md) ## tags() function Add tags for an endpoint. When applied to a class, this decorator adds the tags to all endpoints. **Signature:** ```typescript export declare function tags(...tagNames: string[]): (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"> tagNames </td><td markdown="1"> string\[\] </td><td markdown="1"> A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. </td></tr> </tbody></table> **Returns:** (target: any, method?: string, methodDescriptor?: TypedPropertyDescriptor&lt;any&gt;) =&gt; any ## Example ```ts @oas.tags('greeting', 'public') class MyController { @get('/greet') greet() { return 'Hello world!'; } @get('/echo') echo() { return 'Hello world!'; } } ``` or ```ts class MyController { @oas.tags('greeting', 'public') @get('/greet') greet() { return 'Hello world!'; } @get('/echo') echo() { return 'Hello world!'; } } ```