swagger-api / swagger-api/swagger-ui
passing config to swagger-ui-dist to be able to set swagger URL
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
How do I pass config to swagger-ui-dist?
I just need to do something like
import swaggerUI from 'swagger-ui-dist';
const swaggerUI.updateConfig({url: MY_CUSTOM_URL_TO_SWAGGER_FILE});
const swaggerUiAssetPath = swaggerUI.getAbsoluteFSPath();
ofc updateConfig method is something I made up as a pseudo code for demonstration of what I want to do.
I have seen some solution in issue https://github.com/swagger-api/swagger-ui/issues/9163 with adding a custom html initialiser. But honestly it's ugly solution and adds complexity with handling of serving this html file, and taking care of its dependencies. In my opinion kind of goes against the original idea of swagger-ui-dist. There must be a better way.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining how swagger-ui-dist is used to serve the bundled assets and compare it with the custom HTML initializer described in issue 9163. The work is done when consumers can provide a custom Swagger URL through the package without maintaining a separate HTML initializer.
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