operation-tag-defined
Requires every operation to have tags and every used tag to appear in the top-level tags list.
| Attribute | Value |
|---|---|
| Category | Operations |
| Maturity | Silver |
| OpenAPI | Swagger 2.0; OpenAPI 3.0, 3.1, 3.2 |
| Starter | Off |
| Lenient–Strict | Warning |
| Complete | Error |
Intent
Declared tags provide stable navigation groups and a place to document each operation family.
Flags
- An operation with missing, non-array, or empty
tags. - Each nonblank operation tag name absent from the top-level
tags[].namevalues.
Matching is exact and case-sensitive.
Does not flag
Operations with one or more tags whose nonblank names are declared at document level. This rule does not limit tag count.
See it fail
tags:
- name: Payments
paths:
/refunds:
get:
tags: [Refunds]
responses:
'200': {description: OK}
Refunds is used but not declared.
Fix it
tags:
- name: Payments
- name: Refunds
paths:
/refunds:
get:
tags: [Refunds]
responses:
'200': {description: OK}
Configure
profiles:
default:
rules:
extends: [recommended]
override:
operation-tag-defined: error
Nearby: operation-singular-tag, tag-description, no-duplicated-tag-names.