FAQ

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

    oas2-host-trailing-slash


    Formats: Severity:

    JSON Path: $.host

    The host value cannot end with a trailing slash. The addition of a slash will create invalid URI’s when consumed by tools.

    Why did this violation appear?

    ‘/’ was found at the end of the host property of the specification.

    Bad example

    host: "quobix.com/"
    schemes:
     - "https"
    paths:
     /vacuum:
      ...
    

    Will generate quobix.com//vacuum. The double slash comes from leaving it on the end of the host.

    Good example

    host: "quobix.com"
    schemes:
     - "https"
    paths:
     /vacuum:
      ...
    

    How do I fix this violation?

    Remove ‘/’ from the end of the host property.

    Spectral Equivalent

    The rule is equivalent to oas2-host-trailing-slash