docs icon indicating copy to clipboard operation
docs copied to clipboard

openapi with servers as relative path

Open dmnk89 opened this issue 7 months ago • 0 comments

when using openapi hosted by application server I expect that relative paths will resolve to the server host url instead of docs

The URLs in the servers array can be relative, such as /v2. In this case, the URL is resolved against the server that hosts the given OpenAPI definition. https://swagger.io/docs/specification/v3_0/api-host-and-base-path/#relative-urls

example

docs.json

        "openapi": {
          "source": "https://api.my-host.com/openapi",
          "directory": "api-reference"
        }

/openapi

servers:
  - url: /api/v1

i expect that rendered docs will point to https://api.my-host.com/api/v1

but they just call /api/v1 of hosted docs

dmnk89 avatar Mar 12 '25 15:03 dmnk89