# operation-tags-defined

Source: https://apigenie.pl/docs/linter/openapi/rules/operation-tags-defined

A rule of the OpenAPI linter, which reads OpenAPI 3.0, 3.1 and 3.2 documents. Since 0.0.1. In the rulesets: Recommended at warning, Strict at warning, All at error.

This rule checks that every operation has at least one tag.

## Rule details

Tags group the operations of an API: documentation renders one section per tag, and generated
clients put the operations of a tag in one class. An operation without a tag lands in a group of
its own, named by each tool.

The rule reports `Operation has no tags defined` when `tags` is missing or empty. Turn it off for
an API that does not use tags.

## Examples

**Good**. The operation belongs to the `Users` group.

```yaml
paths:
  /users:
    get:
      tags:
        - Users
      responses:
        "200":
          description: A list of users.
tags:
  - name: Users
```

**Bad**. The operation belongs to no group.

```yaml
paths:
  /users:
    get:
      responses:
        "200":
          description: A list of users.
tags:
  - name: Users
```
