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
49
votes
2 answers

Why `additionalProperties` is the way to represent Dictionary/Map in Swagger/OpenAPI 2.0

Although I have seen the examples in the OpenAPI spec: type: object additionalProperties: $ref: '#/definitions/ComplexModel' it isn't obvious to me why the use of additionalProperties is the correct schema for a Map/Dictionary. It also doesn't…
Chen Levy
  • 15,438
  • 17
  • 74
  • 92
49
votes
3 answers

How to describe this POST JSON request body in OpenAPI (Swagger)?

I have a POST request that uses the following JSON request body. How can I describe this request body using OpenAPI (Swagger)? { "testapi":{ "testapiContext":{ "messageId":"kkkk8", "messageDateTime":"2014-08-17T14:07:30+0530" …
Anirban Sen Chowdhary
  • 8,233
  • 6
  • 39
  • 81
48
votes
4 answers

How to document GraphQL with Swagger \ OpenAPI?

How to document GraphQL with Swagger? We have a huge backend REST API which is recently has partially started to use GraphQL. For documenting API we're using Swagger. The question is: how to use Swagger(OpenAPI) for documenting GraphQL…
user12367662
  • 547
  • 1
  • 4
  • 4
48
votes
10 answers

XML comments file could not be found - Swagger

This is certainly one of those that drives you nuts. As the title indicates all I'm simply trying to do is display comments pulled from an xml file using swagger. I appear to have taken all steps according to the swagger documentation but to no…
Tez Wingfield
  • 2,129
  • 5
  • 26
  • 46
48
votes
4 answers

How to define mutually exclusive query parameters in Swagger (OpenAPI)?

I have a series of parameters in Swagger like this "parameters": [ { "name": "username", "description": "Fetch username by username/email", …
lorless
  • 4,126
  • 8
  • 30
  • 41
47
votes
2 answers

Describe websocket api via Swagger

Is it possible to describe Websocket server api via Swagger? We have events broadcasting via websocket server and i want to describe them via one swagger specification file. Is there any documentation generators for websockets?
Somebody
  • 9,316
  • 26
  • 94
  • 142
46
votes
1 answer

How to convert OpenAPI 2.0 to OpenAPI 3.0?

Are there any tools/libraries to convert OpenAPI 2.0 definitions to OpenAPI 3.0, without doing it one per row?
Rumesh Madhusanka
  • 1,105
  • 3
  • 12
  • 26
46
votes
3 answers

openapi tools generator vs swagger codegen

I am lost in dependencies and tools: I previously use the following tool to generate code for my swagger…
bvdb
  • 22,839
  • 10
  • 110
  • 123
46
votes
6 answers

How to generate swagger.json

I am using java spring boot framework to create REST api for my project and I am using "springfox-swagger2 and springfox-swagger-ui" for generating swagger documentation. I am able to see my documentation using the URL…
Bikesh M
  • 8,163
  • 6
  • 40
  • 52
46
votes
6 answers

Is there a way change the Controller's name in the swagger-ui page?

I'm using Swashbuckle to enable the use of swagger and swagger-ui in my WebApi project. In the following image you can see two of my controllers shown in the swagger-ui page. These are named as they are in the C# code, however I was wondering if…
XN16
  • 5,679
  • 15
  • 48
  • 72
46
votes
5 answers

What is the benefit of using Spring REST Docs comparing to Swagger

Spring REST Docs was released recently and the documentation says: This approach frees you from the limitations imposed by tools like Swagger So, I wanted to ask when Spring REST Docs is preferable to use comparing to Swagger and which limitations…
evgeniy44
  • 2,862
  • 7
  • 28
  • 51
45
votes
14 answers

Swagger UI - " TypeError: Failed to fetch" on valid response

I've just pulled down the latest Swagger from the Git repo (3.0.19) using: https://github.com/swagger-api/swagger-ui.git and updated my API to use the new version. Ran git describe --tags to confirm and my version is currently:…
Hexie
  • 3,955
  • 6
  • 32
  • 55
45
votes
3 answers

How to specify a property can be null or a reference with swagger

How to specify a property as null or a reference? discusses how to specify a property as null or a reference using jsonschema. I'm looking to do the same thing with swagger. To recap the answer to the above, with jsonschema, one could do this: { …
djpinne
  • 673
  • 1
  • 6
  • 9
45
votes
5 answers

Convert Swagger JSON to RAML/YAML

How do I convert Swagger JSON to RAML/YAML and validate it? I am not looking for a programmatic way, just a one off conversion.
helios
  • 2,603
  • 4
  • 21
  • 26
44
votes
6 answers

services.AddSwaggerGen() giving error

All I'm trying to do is add swagger to an ASP.Net Core application. I'm watching a tutorial and all I see them do is add services.AddSwaggerGen(); under the configure services area in the Startup.cs file. Like any normal service like MVC... But I…
Daniel Jackson
  • 1,036
  • 1
  • 11
  • 35