Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Multiple swagger instances not working in version 1.1.x. Works in 1.0.x. #174

Open
xStoryTeller opened this issue Dec 2, 2024 · 0 comments

Comments

@xStoryTeller
Copy link

xStoryTeller commented Dec 2, 2024

For our application we have several routes that are in groups. For each of these groups we would like to have a swagger page.

For example an admin and a user section, something like this:

const admin = new Elysia({ prefix: '/admin' })
  .use(swagger('admin'))
  .use(routes);

const user = new Elysia({ prefix: '/user' })
  .use(swagger('user'))
  .use(routes);

const app = new Elysia()
  .use(admin)
  .use(user)
  .listen(apiPort);

Where the swagger function looks like this

import swagger from '@elysiajs/swagger';
import pkg from '../../package.json';

const path = '/docs';

const apiDocs = function (section?: string) {

  return swagger({
    documentation: {
      info: {
        title: pkg.name + section,
        version: pkg.version,
        description: pkg.description,
      },
      tags: [{ name: description, description }],
    },
    path,
  });
};

export { apiDocs as swagger };

This works perfectly with version 1.0.x, but when you upgrade to 1.1.x all routes are shown in each swagger instead of the separated routes.

@xStoryTeller xStoryTeller changed the title Multiple swagger instances not working in version 1.1.x. Works in 1.0.x. [Bug] Multiple swagger instances not working in version 1.1.x. Works in 1.0.x. Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant