swagger-api / swagger-api/swagger-ui
Improve and fix code rendering and parsing of parameter allowed values and defaults
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Content & configuration
Swagger/OpenAPI definition:
Using latest https://github.com/swagger-api/swagger-ui/releases/tag/v5.32.8
Swagger-UI configuration options:
window.ui = SwaggerUIBundle({
url: "${openapi_json_path}",
dom_id: "#swagger-ui",
deepLinking: true,
defaultModelsExpandDepth: 1,
defaultModelExpandDepth: 1,
docExpansion: "list",
validatorUrl: false,
presets: [
SwaggerUIBundle.presets.apis,
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
tagsSorter: "alpha",
apisSorter : "alpha",
operationsSorter: "alpha",
});
Is your feature request related to a problem?
As shown below, the */* is incorrectly converted into <em>/</em> instead of the expected */*.
Furthermore, the rendering is not that great (code style like paths would be better).
Using the "Try it out" view, the value is correctly */*, so it seems an issue just on the preview of values.
Describe the solution you'd like
It should render similar to what redoc does, which makes interpretation clearer.
It should also ensure proper wraping of the values.
Describe alternatives you've considered
Custom CSS. However, that still doesn't fix the invalid */* value.
The CSS does not allow much flexibility either given how the HTML is generated with broad classes (ie: the enum is pre-concatenated a one comma-separated list of values).
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
Reproduce the issue with the provided api.yaml and SwaggerUIBundle configuration, comparing the parameter allowed-value preview with the correctly rendered Try it out value. Trace the generated preview for the */* value and the comma-separated enum display, then verify that values remain valid, readable, and wrapped as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, javascript, openapi
- Domain
- api, documentation, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100