FAQ

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

    asyncapi-unused-components


    Formats: Severity:

    asyncapi-unused-components reports reusable components that are defined but not referenced outside their own definition.

    Why did this violation appear?

    A component entry exists under components, but vacuum cannot find a reference to it from the rest of the document.

    Bad example

    asyncapi: 3.1.0
    components:
      messages:
        UserCreated:
          payload:
            type: object
        UserDeleted:
          payload:
            type: object
    operations:
      receiveUserCreated:
        action: receive
        messages:
          - $ref: '#/components/messages/UserCreated'
    

    Good example

    asyncapi: 3.1.0
    components:
      messages:
        UserCreated:
          payload:
            type: object
        UserDeleted:
          payload:
            type: object
    operations:
      receiveUserCreated:
        action: receive
        messages:
          - $ref: '#/components/messages/UserCreated'
      receiveUserDeleted:
        action: receive
        messages:
          - $ref: '#/components/messages/UserDeleted'
    

    How do I fix this violation?

    Reference the reusable component from a channel, operation, message, server, schema, binding, or trait, or remove the unused component.