swagger-api / swagger-api/swagger-ui
Long string breaking out of the HTML wrapper
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: Manjaro Linux
- Browser: Firefox
- Version: 120.0
- Method of installation: npm
- Swagger-UI version: 5.0.0
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
Swagger-UI configuration options:
swaggerDefinition: {
openapi: '3.0.0',
info: {
title: 'API',
description: 'API documentation.',
version: '1.0.0'
},
externalDocs: {
description: 'View swagger.json',
url: '../swagger.json'
},
servers: [],
tags: [],
components: {
schemas: {},
securitySchemes: {}
}
},
apis: ['src/controller/*.ts', 'controller/*.js']
Path configuration in yaml
/auth/login:
post:
tags:
- auth
summary: Login an authenticated user
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LoginRequest'
required: true
responses:
'200':
description: >
Return a JWT refresh token in a cookie named refreshToken if rememberMe is true.
If successfully login, return the JWT access token and the user active game
headers:
Set-Cookie:
schema:
type: string
example: refreshToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTI5LCJlbWFpbCI6Im9yaW9uLmJvb3RjYW1wQGVtYWlsLmNvbSIsImlhdCI6MTcwMTI3MzAyMSwiZXhwIjoxNzAxMzU5NDIxfQ.eEsHjdizASxt6RWslDHZMgypd7zFXN1uewtjr0S19NM; Path=/; HttpOnly; SameSite=Strict
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseData'
example:
success: true
message: 'Successful login.'
data:
accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTE2LCJlbWFpbCI6Im9yaW9uLmJvb3RjYW1wQGVtYWlsLmNvbSIsImlhdCI6MTcwMDc1MDUyOX0.Ly8x6f0KOTiW_VmCbYa0b6ejKi4dF8dGydT4VFKj4oo'
game:
lives: 3
record: 40
combo: 9
isActive: true
Describe the bug you're encountering
There is a path in API which has a Set-Cookie response header which contains a very long string.
This string is breaking out of the HTML wrapper and leading all Example Values to extend to the same width, as you can see in the image below:
Additional context or thoughts
This behavior no long occurs after removing the cookie example string.
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 in Swagger UI using the provided OpenAPI response with the long Set-Cookie example, then inspect how the Example Values are rendered inside the HTML wrapper. Done means the long cookie string no longer expands the wrapper or forces other Example Values to the same width.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, html, javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100