open-api icon indicating copy to clipboard operation
open-api copied to clipboard

Allow ability to disable "servers" property from automatically forwarding all requests

Open Nik-Novak opened this issue 5 years ago • 1 comments

Currently, if you specify a server property in the api spec like so:

servers:
  - url: https://services.mydomain.com/my-service
    description: External endpoint
  - url: http://internal-services/my-service
    description: Internal endpoint

All requests to the express server need to be prepended with a /my-service/PATH. This is rather annoying for hosting local/test versions of the api, or cases like mine where a nginx server does the routing. The server should have the option to follow only the strict paths in /paths, instead of automatically applying /my-service/ as a requirement to the path just due to the fact that it si listed under services.

Unfortunately, to be able to generate proper documentation, often that server property is necessary, otherwise I would exclude it to prevent this automatic-forwarding behaviour. Could a flag like ignoreServerPaths be added to accomplish this?

Nik-Novak avatar Apr 15 '20 12:04 Nik-Novak

i'd be open to PRs for this.

jsdevel avatar May 19 '20 22:05 jsdevel