Open armen-ch opened 1 year ago
@armen-ch So what's mentioned in the swagger docs is applicable to only where you use can use/link external resource via link directly. It doesn't not apply to servers as value of url
in sever is absolute (i.e. string
).
Also, URLs are relative to where file is hosted. So for example if it's hosted at localhost:1337/definition.yaml' than all resources you mention via relative URL should be present a
localhost:1337/{resource}`.
To clarify more, see section "Overriding Servers". It states that The global servers array can be overridden on the path level or operation level.
. It does not mention anything for relative URLs.
Examples mentioned in this doc have relative URLs for termsOfService
and externalDocs
where you can link URL itself where actual resource is present. There's no mention of server URLs also accepting relative URL here.
According to https://swagger.io/docs/specification/api-host-and-base-path/ "Relative URLs" if relative path is specified on the path level or operation level and if the definition hosted at http://localhost:3001/openapi.yaml and specifies url: /v2, the url is resolved to http://localhost:3001/v2. So based on this my expectation is if I specify relative path on non-global level like below:
then it should be resolved to http://localhost:3001/v2 and openapi-to-postman will generate something like:
but currently the collection is generated without the host parameter: