elysiajs / elysia-swagger

A plugin for Elysia to auto-generate Swagger page
MIT License
74 stars 36 forks source link

`basePath` Swagger Object configuration does not seem to be supported #89

Open jcarpe opened 6 months ago

jcarpe commented 6 months ago

Bun v1.0.15 Elysia: v0.8.8 Elysia/swagger: v0.8.0

When adding a prefix to my Elysia configuration:

export const elysia = new Elysia({ prefix: BASE_PATH })

I believe I would need to be able to then apply a basePath configuration per the Swagger object config: https://swagger.io/specification/v2/

// pseudo code that does not appear to function as expected
.use(swagger({
  documentation: {
    basePath: BASE_PATH,
    info: {}
  }
}))

The basePath does not appear to be a property of the defined type for the documentation configuration, but this is where it seems to logically appear in the swagger configuration.

marclave commented 6 months ago

we should also be setting basePath at root for swagger 2.0 the specification, so we can keep the same paths for the endpoints but not have the basePath part of it for the sidebar for example (or swagger ui collapsable sections)

https://swagger.io/docs/specification/2-0/api-host-and-base-path/

jcarpe commented 5 months ago

Just a rather broad update/note here. I've actually been having better success following the 3.0 specification. Still not a resolution to the above though.

ruslanguns commented 3 months ago

Any work around so I can set the base path accordingly to it? thanks in advance!