FAQ

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

    oas3-host-trailing-slash


    Formats: Severity:

    JSON Path: $.servers[*]

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

    This rule is also covered by the oas3-api-servers rule. If you enable both of these rules, then you will see a ‘double’ hit.

    Why did this violation appear?

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

    Bad example

    servers:
     - url: "https//quobix.com/"
    paths:
     /vacuum:
      ...
    

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

    Good example

    servers:
     - url: "https//quobix.com"
    paths:
     /vacuum:
    

    How do I fix this violation?

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

    Spectral Equivalent

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