swagger-api / swagger-api/swagger-ui

Configure swagger-ui-dist URL server side

Open
#5,710 6 comments 16 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Is your feature request related to a problem?

This issue is related to the #4624 and the swagger-ui-dist library. There is no way to change the url on the server side without modifying the node_module folders or without having an endpoint that accept requests for the index.html and that serves the modified index. Both this solution are not acceptable, in fact for the first one it's clearly a bad practice to change the node_modules folder content on runtime and for the second I cannot replace an example URL that I have no certainty it will be constant in each update.

Describe the solution you'd like

I do not know a clear solution for this problem. Maybe the only way is indeed to modify the content of the index.html but at least I was expecting that there will be a function to do that inside the library. Maybe this is the simplest solution.

Describe alternatives you've considered
  • [ ] Save index.html content and serve it to the index.html endpoint (not so usable without Express or similar)
  • On application startup replace https://petstore.swagger.io/v2/swagger.json with my JSON swagger configuration endpoint.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing how swagger-ui-dist uses index.html and the server-side URL configuration described in the issue. Compare the listed alternatives—modifying node_modules, serving a modified index.html, or replacing the example URL at startup—and define a supported approach that avoids runtime package changes while allowing a custom configuration endpoint.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.