swagger-ui

How to display curl command in Swagger?


I am using Swagger UI 3.24.2 and I want the curl statement to always show up in the UI. Currently, it shows up only when I click on the 'Try it out' button. Is there a straight forward way of achieving this behavior? I believe in the 2.0 version this behavior was enabled by default.

Thanks!


Solution

  • I want the curl statement to always show up in the UI.

    This is currently not supported, but there's a feature request:
    Add option to generate CURL in summary if OpenAPI definition has examples.

    Currently, Swagger UI generates the cURL command with the specific parameter values that the user entered, that's why cURL is only available after "try it out".


    I believe in the 2.0 version this behavior was enabled by default.

    No, this behavior is the same in v. 2.x and 3.x