swagger-api / swagger-api/swagger-ui
Vertical bar character | is not escaped in cURL (CMD) request snipped body
Open
@Divyanshu-Mishra9620 is already working on this.
Since Oct 8, 2025.
Good first issue
P3
pull-request-welcome
type: bug
- 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: Windows 11
- Browser: chrome
- Version: 138.0.7204.169
- Method of installation: springdoc-openapi
- Swagger-UI version: 5.21.0
- Swagger/OpenAPI version: Swagger 2.2.30, OpenAPI 3.0
Content & configuration
Swagger-UI configuration options (request snippets enabled):
requestSnippetsEnabled: true
Describe the bug you're encountering
The vertical bar character | in the cURL (CMD) request body of the request snippet is not escaped. When running the generated CMD command, the first string after the | is considered a command.
To reproduce...
Steps to reproduce the behavior:
- Enable request snippets
- Construct a "Try it out" request with a JSON request body having the vertical bar/pipe character
| - Execute the request and copy the generated
cURL (CMD)snippet into a Windows cmd.exe - The
|character is not escaped which leads to a'some-string' is not recognized as an internal or external command, operable program or batch file.error message in CMD
Expected behavior
The vertical bar character | in the request body of CMD curl snippets is escaped (with a caret ^)
Screenshots
Not escaped | in request body:
Escaped | in request body:
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.
Assessment
This issue has not been assessed yet.