FAQ

  • GitHub GitHub Repo stars
  • Discord Discord Server
  • ✨ New! Try the OpenAPI Doctor ✨ The OpenAPI Doctor
    Recommended

    operation-tag-defined


    Formats: Severity:

    Operation Tags are used to define operation categories or groups.

    Sometimes, tags that have been defined for an operation, have not been defined as part of the global scope of the specification.

    This is technically allowed, however it’s Bad OpenAPI hygiene. The rule will throw a warning. Make sure tags used by operations are always defined in the global scope of the document.

    Why did this violation appear?

    A tag was used in an operation, without that tag being defined in the global scope.

    What is this rule checking for?

    Every Operation has to use tags that have been declared globally as part of the tags definition.

    Bad example

    tags:
      - name: snakes
        description: snakes on a plane?
      - name: cakes
        description: We much prefer cakes on a plane.
    paths:
      /snakes/cakes:
      post:
        tags: 
          - someRandomUndefinedTag
    

    Good Example

    tags: 
      - name: snakes
        description: snakes on a plane?
      - name: cakes
        description: We much prefer cakes on a plane.
    paths:
      /snakes/cakes:
        post:
          tags: 
            - snakes
            - cakes
    

    How do I fix this violation?

    Make sure that any tags used by an operation, have been globally declared in the specification tags definition.

    Spectral Equivalent

    The rule is equivalent to operation-tag-defined