swagger-api / swagger-api/swagger-ui

Swagger-UI: ugly numbered rendering of enum "allowed values"

Open
#10,555 4 comments 0 reactions 1 assignee View on GitHub

@sajdakabir is already working on this.

Since Oct 7, 2025.

P3 pull-request-welcome type: enhancement
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A
  • OS: Linux
  • Browser: Chrome, Firefox, probably all of them
  • Version:
  • Method of installation: Docker
  • Swagger-UI version: 5.20.0
  • Swagger/OpenAPI version: whatever's in the swaggerapi/swagger-ui:5.20.0 Docker image, OpenAPI 3.1.0
Content & configuration

Example Swagger/OpenAPI definition:

{
	"MyEnum": {
		"type": "string",
		"enum": [
			"allowedValue1",
			"allowedValue2",
			"allowedValue3",
			"allowedValue4"
		]
	}
}

Swagger-UI configuration options:

const ui = SwaggerUIBundle({
	urls: [
		{url: "https://{$DOMAIN_NAME}/api/a", name: "a"},
		{url: "https://{$DOMAIN_NAME}/api/b", name: "b"}
	],
	dom_id: '#swagger-ui',
	presets: [
		SwaggerUIBundle.presets.apis,
		SwaggerUIStandalonePreset
	],
	layout: "StandaloneLayout",
	tryItOutEnabled: true,
	validatorUrl: null,
	plugins: [
	SwaggerUIBundle.plugins.DownloadUrl
	],
	deepLinking: true
});

Describe the bug you're encountering

In Swagger-UI 5.19.0, the allowed values are rendered in a pretty listing in dotted-border boxes, and 5.20.x onwards, they render as:

#0"allowedValue1"
#1"allowedValue2"
#2"allowedValue3"
#3"allowedValue4"
To reproduce...

Steps to reproduce the behavior:

  1. have a schema with an enum type
  2. click Schemas and Expand for the enum type
Expected behavior

Render a pretty listing of allowed values :D

Screenshots
Swagger-UI >=5.14.x <= 5.19.x
Image
Swagger-UI >= 5.20.x:
Image
Additional context or thoughts

On further investigation, this goes for other types of "example" elements too.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.