-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Invalid HTML ID for Operations with tags which contain multiple words #4537
Copy link
Copy link
Closed
Description
Q&A (please complete the following information)
- OS: macOS
- Browser: safari
- Version: 11.1
- Method of installation: npm
- Swagger-UI version: 3.14.1
- Swagger/OpenAPI version: Swagger 2.0
Content & configuration
Example Swagger/OpenAPI definition:
Use the Petstore demo and change one of the tags to multiple words, e.g.:
{
"tags": [
{
"name": "pet store"
}
]
"paths": {
"/pet": {
"post": {
"tags": [
"pet store"
],
}
}
}
}Swagger-UI configuration options:
Just use the Petstore demo and change the link to your adapted Swaggerfile:
const ui = SwaggerUIBundle({
url: "http://localhost:8000/swagger.json"
// ...
})Describe the bug you're encountering
To reproduce...
Steps to reproduce the behavior:
- Go to
http://localhost:3200/ - Open your Developer Tools
- Select the first operation of the 'pet store' section with the element inspector
- Take a look at the HTML markup of this element:
<div class="opblock opblock-post" id="operations-pet store-addPet">...</div>Expected behavior
The ID should be a valid HTML ID, like on the operation section itself:
<h4 class="opblock-tag" id="operations-tag-pet_store">...</h4>Screenshots
Additional context or thoughts
This bug can be easily fixed within /src/core/components/operation.jsx by importing the function createDeepLinkPath() and adapting line 97. Similar as within operations.jsx:
import { createDeepLinkPath } from "core/utils"
let isShownKey = ["operations", createDeepLinkPath(tag), operationId]Reactions are currently unavailable
