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

Fix nested path issue in Swagger and Scalar config #146

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

chrisllontop
Copy link
Contributor

@chrisllontop chrisllontop commented Sep 3, 2024

This PR fixes the issue reported on #135

@marclave marclave self-requested a review September 25, 2024 23:38
@marclave marclave merged commit 337926c into elysiajs:main Sep 25, 2024
1 check passed
@chrisllontop chrisllontop deleted the fix/relative-specs-path branch September 25, 2024 23:47
@LhonRafaat
Copy link

When is this gonna release?

@TheGU
Copy link

TheGU commented Jan 19, 2025

When we set the prefix for Elysia, this change breaks the swagger user interface.

Minimal code to test that was functional before to this update and will malfunction once it is implemented.

import { Elysia } from 'elysia'
import { swagger } from '../src/index'

const app = new Elysia({ prefix: '/api' })
    .use(swagger())
    .get('/id/:id?', 'a')
    .listen(3000)

The issue is that it appends "/" to the beginning of the route, making it begin at the root rather than a relative. Therefore, when we open the Swingger UI, it attempts to retrieve the openapi json from
http://localhost:3000/swagger/json
, but it cannot find it. It should be
http://localhost:3000/api/swagger/json .
This is because it removes the relative path and starts with from root with url start with "/"

This might be relate to #183 , #162 , #151
It should also solve a problem for #154

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

Successfully merging this pull request may close these issues.

4 participants