Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curl Command has \ in the command, GET has single quotes around it, and double quotes replaced by single #7186

Closed
KayakFisher205 opened this issue Apr 15, 2021 · 3 comments

Comments

@KayakFisher205
Copy link

Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: [e.g. chrome, safari]
  • Version: 89.0.4389.128
  • Method of installation: Nuget (via Swashbuckle.AspNetCore)
  • Swagger-UI version: 3.46.0
  • Swagger/OpenAPI version: . Swagger 2.0, OpenAPI 3.0

Content & configuration

Configured directly with the Swashbuckle. AspNetCore Nuget

Describe the bug you're encountering

Currently, my curl looks like:
curl -X 'GET'
'http://localhost:46528/EafLmfOpc/SerialNumber'
-H 'accept: text/plain'

I can't say how long ago, but my curl was:
curl -X GET "http://localhost:46528/EafLmfOpc/SerialNumber" -H "accept: text/plain"

To reproduce...

Steps to reproduce the behavior:

  1. Start API in Debug
  2. select any API command (ex. Get /EafLmf/Opc/SerialNumber)
  3. Try out and Execute
  4. Data is returned OK, but Curl command is wrong.

Expected behavior

I would expect it to be correct.

Screenshots

image

Additional context or thoughts

I haven't changed any code or upgraded anything. I wasn't sure exactly what creates the Curl command and if some type of JSON change is changing the actual command. Its not a major issue, but just trying to understand whats going on.

@hkosova
Copy link
Contributor

hkosova commented Apr 15, 2021

The default cURL command was changed to Bash style as a result of the "Request snippets" PR #6910. The requestSnippetsEnabled: true configuration option can be used to also display Windows-specific cURL command (with double quotes) and PowerShell cURL command in addition to the default Bash syntax. Here's a Swagger UI demo with this option: https://petstore.swagger.io/?requestSnippetsEnabled=true

Since you're using Swashbuckle, check with them if they expose the requestSnippetsEnabled option.

@hkosova
Copy link
Contributor

hkosova commented May 5, 2021

Closing due to inactivity.

This is simply to keep the issue tracker clean - feel free to comment if there are any further thoughts or concerns, and we'll be happy to reopen this issue.

@hkosova hkosova closed this as completed May 5, 2021
@KayakFisher205
Copy link
Author

I'm sorry, I didn't follow up. This might be helpful for someone finding my question. This was the suggestion I received and it worked perfectly.

While the SwaggerUI middleware doesn't currently have a top-level config method for this, it does have a mechanism to add any config items you like. For example, I was able to enable the request snippets plugin as follows:

app.UseSwaggerUI(c =>

{

c.ConfigObject.AdditionalItems.Add("requestSnippetsEnabled", true);

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants