Questions tagged [swagger]

Swagger is a framework implementation for describing, producing, consuming, and visualizing RESTful web services, based on the OpenAPI specification

Swagger is a specification and framework implementation for describing, producing, consuming and visualizing RESTful web services. It is a unique way to document your RESTful APIs on the go, as and when you code them.

The main advantage of Swagger is its flexibility - it can produce static and dynamic REST API documentation. There is even the possibility to interact with the webservice and send example queries.

It's developed by SmartBear.

On Nov 5th, 2015, the Open API Initiative extended Swagger as an OpenAPI specification to advance connected application development through open standards. Please refer to the announcement for more information.

Useful links

Frequently Asked Questions

People often ask about the following Swagger topics:

Related tags

11997 questions
60
votes
8 answers

Actions require unique method/path combination for Swagger

I have 2 HTTP GET method in same controller and give me this error HTTP method "GET" & path "api/DataStore" overloaded by actions - DPK.HostApi.Controllers.DataStoreController.GetByIdAsync…
user9390243
60
votes
9 answers

How to generate basic TypeScript interfaces from Swagger schema?

I'm looking for a way to generate simplistic TypeScript interfaces from a Swagger schema. Most solutions I find are needlessly complicated. I would like to generate interfaces like this: export interface IBar { a?: string; b: number; c:…
Ivan Koshelev
  • 3,830
  • 2
  • 30
  • 50
58
votes
1 answer

What is Swagger, Swashbuckle and Swashbuckle UI

This is my understanding: Swagger is a notation/rules to write documentation. But why is it called a framework (like Angular/MVC)? Swashbuckle is a program (JavaScript?) that generates the documentation (based on Swagger rules). Swagger UI…
Blue Clouds
  • 7,295
  • 4
  • 71
  • 112
57
votes
4 answers

How to generate a Swagger #definition from sample JSON

Take the following #definition from the pet store example. Given a #definition section a JSON structure can be generated e.g. Is there something that can do the reverse given a largeish complex JSON file? Given the below JSON Structure can I get…
user1605665
  • 3,771
  • 10
  • 36
  • 54
56
votes
9 answers

How do you turn off swagger-ui in production

I have swagger plugged in to my spring boot application. Spring boot allows you to have property files for each environment that you have. Is there a way to disable swagger for a production environment?
user301693
  • 2,377
  • 7
  • 22
  • 24
56
votes
1 answer

What is Swagger and does it relate to OData?

I am familiar with the Microsoft stack. I am using OData for some of my restful services. Recently I came across Swagger for API documentation and I am trying to understand how it relates to OData. Both of them seem to be RESTful specifications.…
Muthukumar
  • 8,679
  • 17
  • 61
  • 86
55
votes
6 answers

How can I set a description and an example in Swagger with Swagger annotations?

I am creating a REST Api using Spring boot, and auto generating the swagger documentation in controllers using swagger codegen. However, I am not able to set a description and example for a parameter of type String in a POST request. Here is mi…
Roman
  • 1,691
  • 4
  • 18
  • 35
54
votes
23 answers

Added Springfox Swagger-UI and it's not working, what am I missing?

Following the instructions here: http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api I added these dependencies to my project: compile "io.springfox:springfox-swagger2:2.7.0" compile "io.springfox:springfox-swagger-ui:2.7.0" and…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
54
votes
3 answers

Keycloak integration in Swagger

I have a Keycloak protected backend that I would like to access via swagger-ui. Keycloak provides the oauth2 implicit and access code flow, but I was not able to make it work. Currently, Keycloak's documentation is lacking regarding which url should…
melistik
  • 541
  • 1
  • 4
  • 4
53
votes
1 answer

Swagger:Issue with Path parameter

I am try to create a swagger file with the following path: paths: /v1/customers/{id}/summary : However I get the following error right off bat: API requires path parameter but it is not defined: id at paths ▹ /v1/customers/{id}/summary It…
user2825273
  • 565
  • 1
  • 4
  • 9
52
votes
5 answers

Specify an array of strings as body parameter in swagger API

I would like to post an array of strings like [ "id1", "id2" ] to a Swagger based API. In my swagger file, I have those lines: paths: /some_url: post: parameters: - name: ids in: body required: true What…
Achim
  • 15,415
  • 15
  • 80
  • 144
52
votes
4 answers

Swagger: map of

I need to document with Swagger an API that uses, both as input and output, maps of objects, indexed by string keys. Example: { "a_property": { "foo": { "property_1": "a string 1", "property_2": "a string 2" …
Xavier Lamorlette
  • 1,152
  • 1
  • 12
  • 20
50
votes
25 answers

Springfox swagger-ui.html unable to infer base URL - Caused by missing cookies

We have our Spring Boot services behind an API Gateway. With an earlier version of Springfox - 2.1.2 we had no issues in loading the swagger-ui.html page. This worked with Spring Boot 1.4.3.RELEASE. From then, we have upgraded to Boot 1.5.7 and…
Arnab Gupta
  • 677
  • 1
  • 5
  • 9
50
votes
10 answers

swagger @ApiModelProperty example value for List property

I have one class in which there is one property which is List public class MyClass { .... @ApiModelProperty(position = 2) private List productIdentifiers; .... } This code generates the example values as…
Anil Bharadia
  • 2,760
  • 6
  • 34
  • 46
50
votes
4 answers

Enable bearer token in Swashbuckle (Swagger document)

I created an asp.net webapi application which is using Individual Account Security so that the Bearer token is enabled by default. It's working fine so that I am able to test them in Postman without problem. Here comes the question when I'm trying…
Bagusflyer
  • 12,675
  • 21
  • 96
  • 179