Closed augensalat closed 4 years ago
In https://github.com/jhthorsen/mojolicious-plugin-openapi/issues/116#issuecomment-469418806 I learned how M:P:OpenAPI modifies the basePath value: It uses Mojo's url_for() to prepend the potential mount path of the application to the basePath: https://github.com/jhthorsen/mojolicious-plugin-openapi/blob/master/lib/Mojolicious/Plugin/OpenAPI/SpecRenderer.pm#L85 If I have a basePath: / in my OpenAPI2 spec file, and the whole application is mounted under /api, then in the resulting spec (available under scheme:host/api) I get
basePath
url_for()
basePath: /
/api
scheme:host/api
{ "basePath": "/api" }
Unfortunately the same procedure is not run for OpenAPI3's servers array: If I have
servers
servers: - url: /
in my spec, and the whole application is again mounted under /api, then in the resulting spec (available under scheme:host/api) I get
{ "servers": [ {"url": "/"} ] }
The expected output would have been
{ "servers": [ {"url": "/api"} ] }
of course.
Thanks!
In https://github.com/jhthorsen/mojolicious-plugin-openapi/issues/116#issuecomment-469418806 I learned how M:P:OpenAPI modifies the
basePath
value: It uses Mojo'surl_for()
to prepend the potential mount path of the application to thebasePath
: https://github.com/jhthorsen/mojolicious-plugin-openapi/blob/master/lib/Mojolicious/Plugin/OpenAPI/SpecRenderer.pm#L85 If I have abasePath: /
in my OpenAPI2 spec file, and the whole application is mounted under/api
, then in the resulting spec (available underscheme:host/api
) I getUnfortunately the same procedure is not run for OpenAPI3's
servers
array: If I havein my spec, and the whole application is again mounted under
/api
, then in the resulting spec (available underscheme:host/api
) I getThe expected output would have been
of course.