@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
71 lines (50 loc) • 1.61 kB
Markdown
---
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/strongloop/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) > [@loopback/openapi-v3](./openapi-v3.md) > [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.
<b>Signature:</b>
```typescript
export declare function tags(...tagNames: string[]): (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor<any> | undefined) => any;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| tagNames | string\[\] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. |
<b>Returns:</b>
(target: any, method?: string \| undefined, methodDescriptor?: TypedPropertyDescriptor<any> \| undefined) => 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!';
}
}
```