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

scalarConfig.spec.url is resolved incorrectly when the path option contains a subdirectory. #97

Open
dtinth opened this issue Jan 26, 2024 · 1 comment

Comments

@dtinth
Copy link

dtinth commented Jan 26, 2024

The changes introduced in #59 breaks in the case where swagger is mounted with path in the subdirectory.

const app = new Elysia()
  .use(
    swagger({
      path: "/services/docs",
    })
  )
  .get("/services/hello", () => ({ ok: true }));

When going to /services/docs, I get a blank page. This is because Scalar tries to load the data from /services/services/docs/json.

image

Current workaround is to manually override the scalarConfig

const app = new Elysia()
  .use(
    swagger({
      path: "/services/docs",
      scalarConfig: {
        spec: { url: "/services/docs/json" },
      },
    })
  )
  .get("/services/hello", () => ({ ok: true }));
@DeluxeOwl
Copy link

I also have this problem

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

2 participants