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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the swagger-ui url to be customised further #117

Open
2 tasks done
knolleary opened this issue Jan 10, 2024 · 2 comments
Open
2 tasks done

Allow the swagger-ui url to be customised further #117

knolleary opened this issue Jan 10, 2024 · 2 comments

Comments

@knolleary
Copy link
Contributor

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

馃殌 Feature Proposal

@fastify/swagger-ui provides the routePrefix option that allows you to modify the default route prefix of /documentation. For example: /api-docs. This allows some level of customisation.

However, when you browse to the routePrefix, the plugin is hardcoded to redirect you to /api-docs/static/index.html.

I would like the swagger ui to be served from /api-docs/ without that redirection.

Is there a specific reason or limitation with the swagger-ui that requires this redirection? There may be some subtle aspects on how swagger-ui expects to load its own static assets that make this hard than it sounds.

I don't have a specific proposal at this stage for how this behaviour would be enabled in the configuration - most likely a boolean flag to disable the redirect... although what that gets called is open to suggestion.

Motivation

My main motivation here is trying to keep our application's URls consistent and tidy.

We don't use index.html in the path for any of our routes - I'd prefer the swagger-ui follows what we have elsewhere.

Example

No response

@mcollina
Copy link
Member

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@jdhollander
Copy link

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

I've made a pull request #144 that implements this feature. I'd be grateful to those in this thread to see what they think.

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

3 participants