tags-unique
Since 0.9.0 · fixed by --fix · In the rulesets: Recommended at warning, Strict at error, All at error
This rule checks whether the names of the tags listed in info.tags are
unique.
Rule details
Duplicate tags are confusing: documentation generators may render the same section twice, or merge the tags in an unpredictable way.
The tags-unique rule checks the info.tags list of an AsyncAPI document,
and reports Tag name is not unique (<name>) for every tag whose name
repeats the name of another tag in the list. Names are compared
case-insensitively, so Pets and pets are duplicates. Tags of operations,
messages and other objects are not checked.
Examples
Good.
asyncapi: 3.0.0
info:
title: Pet Events
version: 1.0.0
tags:
- name: adoption
description: Events related to adopting and returning pets.
- name: inventory
description: Events related to the shelter inventory.
Bad.
asyncapi: 3.0.0
info:
title: Pet Events
version: 1.0.0
tags:
- name: adoption
description: Events related to adopting and returning pets.
- name: Adoption
Automatic fixes
--fix removes redundant duplicates:
- a duplicate that contains only a
nameis removed; if the earlier tag contains only anameand the later one has more content, the earlier tag is removed instead, - a duplicate whose content (apart from the
name) is identical to the earlier tag is removed.
Duplicates that differ in their descriptions or other properties are reported but not fixed, as the rule cannot tell which one is correct. In the “Bad” example above, the second tag is removed.
Turn it off or change its severity
In apigenie.yaml, off turns the rule off and warning or error sets its severity; a rule with options takes the severity and the options as a pair, [warning, options]. lint.asyncapi has the details.
commands:
lint:
asyncapi:
rules:
tags-unique: off