Validates that tag parent references are properly defined and don't create circular dependencies.
| OAS | Compatibility |
|---|---|
| 2.0 | ❌ |
| 3.0 | ❌ |
| 3.1 | ❌ |
| 3.2 | ✅ |
tags:
- name: string
parent: string
description: string
externalDocs: objecttags:
- name: products
description: All products
- name: books
parent: products
description: Books categoryThe default setting for this rule (in the built-in recommended configuration) is error.
OpenAPI 3.2 introduced the ability to organize tags in a hierarchical structure using the parent field. This rule ensures that:
- Parent tags exist: Any tag referenced as a parent must be defined in the
tagsarray. - No circular references: Tag parent relationships must not create circular dependencies.
Proper tag hierarchy helps organize your API documentation and makes it easier for users to navigate related endpoints.
To configure the rule, add it to the rules object in your configuration file. Set the desired severity for the rule.
rules:
spec-no-invalid-tag-parents: error| Option | Type | Description |
|---|---|---|
| severity | string | Possible values: off, warn, error. Default error (in recommended configuration). |
An example configuration:
rules:
spec-no-invalid-tag-parents: errorGiven this configuration:
rules:
spec-no-invalid-tag-parents: errorExample of incorrect tags (undefined parent):
tags:
- name: books
parent: productsExample of incorrect tags (circular reference):
tags:
- name: comics
parent: books
- name: books
parent: comicsExample of correct tags:
tags:
- name: products
- name: books
parent: products