FAQ

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

    asyncapi-server-variables


    Formats: Severity:

    asyncapi-server-variables compares variables used in server host and pathname templates with the server variables object.

    Why did this violation appear?

    A server template uses an undefined variable, or the server declares a variable that is not used in host or pathname.

    Bad example

    asyncapi: 3.1.0
    servers:
      production:
        host: '{}.events.example.com/'
        pathname: /events/{unused}/
        protocol: mqtt
        variables:
          stale:
            default: acme
    

    Good example

    asyncapi: 3.1.0
    servers:
      production:
        host: '{tenant}.events.example.com'
        pathname: /events/{region}
        protocol: mqtt
        variables:
          tenant:
            default: acme
          region:
            default: us-east
    

    How do I fix this violation?

    Define every template variable and remove variables that are no longer used.