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:

Q&A (please complete the following information)
Content & configuration
Swagger-UI configuration options (request snippets enabled):
requestSnippetsEnabled: trueDescribe the bug you're encountering
The vertical bar character
|in thecURL (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:
|cURL (CMD)snippet into a Windows cmd.exe|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 CMDExpected 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: