[Question] Override basePath in api documentation

(Redplane Dt) #1


I’m using next.stoplight.io as an api documentation tool for my project.
Currently, I have been setting basePath as /api. Therefore, my api end-points will be:

  • /api/user/register
  • /api/user/search

My project uses IdentityServer4, they provide some extra end-point like:

  • /connect/token

I tried to set the IdentityServer4 end-point in stoplight as ~/connect/token, but it threw an error.
How can I override the basePath ?


(Taylor Barnett) #2

I do not think that OpenAPI 2 supports multiple basePaths, so I don’t think there is a way to make it work like this. Is the IdentityServer4 endpoint part of the same API?

(Redplane Dt) #3

No. IdentityServer4 has different end-point.
Its end-points don’t contain api/

Actually, I can remove basePath and put api prefix to every api, but it will be time consuming if I have dozens of end-points.

Therefore, it would be nice if there is any solution which allows user to override basePath in stoplight documentation.

(Taylor Barnett) #4

Sadly, there isn’t a better workaround than adding the prefix to the paths themselves.

We try to stick as close to the specification as possible, but with OAS 3 it should be possible. OAS 3 Editor support exists right now, but visual editor is coming very soon.