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
37
votes
1 answer

How to refer to enclosing type definition recursively in OpenAPI / Swagger?

I'm writing an OpenAPI definition in Swagger Editor. One of my type definitions contains an array containing child elements of the same type as the parent. I.e. something like this: definitions: TreeNode: type: object properties: …
Morten
  • 684
  • 1
  • 5
  • 15
37
votes
7 answers

How to break swagger 2.0 JSON file into multiple modules

I'm trying to break my API document up into multiple JSON files that can be edited independently. All the examples I've been able to find use the Swagger 1.2 schema which has a "api":{} object for breaking it down. That appears to be missing from…
John P
  • 1,540
  • 2
  • 22
  • 34
36
votes
6 answers

How do I combine multiple OpenAPI 3 specification files together?

I want to combine an API specification written using the OpenAPI 3 spec, that is currently divided into multiple files that reference each other using $ref. How can I do that?
heitortsergent
  • 1,971
  • 2
  • 20
  • 23
36
votes
21 answers

Swagger with Spring Boot 2.0 leads to 404 error page

I'm trying to integrate my Spring Boot version 2.0.1.RELEASE with Swagger. From this blog post it seemed like it will be easy by just adding two Maven dependencies and everything should work. So I added the following dependencies to the…
riorio
  • 6,500
  • 7
  • 47
  • 100
36
votes
8 answers

How to redirect root to swagger in Asp.Net Core 2.x?

I'm building Asp.Net Core 2.x web api integrated with Swagger. To access the swagger, I had to append /swagger to the url, eg. https://mywebapi.azurewebsites.net/swagger/ How can I redirect https://mywebapi.azurewebsites.net/ to…
Syaiful Nizam Yahya
  • 4,196
  • 11
  • 51
  • 71
36
votes
3 answers

Swagger complex response model with dynamic key value hash maps

I'm struggling with the syntax of swagger to describe a response type. What I'm trying to model is a hash map with dynamic keys and values. This is needed to allow a localization. The languages may vary, but english should always be provided. The…
user1736217
  • 425
  • 1
  • 4
  • 7
36
votes
7 answers

Use JWT (Authorization: Bearer) in Swagger in ASP.NET Core

I'm creating a REST api in ASP.NET Core 1.0. I was using Swagger to test but now I added JWT authorization for some routes. (with UseJwtBearerAuthentication) Is it possible to modify the header of the Swagger requests so the routes with the…
MonkeyDreamzzz
  • 3,978
  • 1
  • 39
  • 36
36
votes
5 answers

Multi-line literals in swagger editor?

I am trying to get a multi-line literal in Swagger editor (awesome tool, by the way!). post: summary: Translate one or more identifiers description: | Translate one or more identifiers for one entity into the identifiers of another entity.…
fool4jesus
  • 2,147
  • 3
  • 23
  • 34
35
votes
13 answers

How to run Swagger 3 on Spring Boot 3

Using a fresh Spring Initialzr with Java17 and Spring Boot 3.0.0, and an extra addition to the pom.xml for Springfox Swagger 3, I can't for the life of me get Swagger pages to work. Instead, I get the whitelabel error page with 404. Pom.xml
Ahmed Tawfik
  • 1,159
  • 1
  • 8
  • 13
35
votes
1 answer

NSwag vs Swashbuckle

I've read in the documentation that "The two main OpenAPI implementations for .NET are Swashbuckle and NSwag" but what are the differences between them?
Stanislav
  • 4,389
  • 2
  • 33
  • 35
35
votes
6 answers

Spring Boot & Swagger UI. Set JWT token

I have a Swagger config like this @EnableSwagger2 @Configuration public class SwaggerConfig { @Bean public Docket api() { List schemeList = new ArrayList<>(); schemeList.add(new…
isADon
  • 3,433
  • 11
  • 35
  • 49
35
votes
4 answers

Slate vs Swagger - Which is better and which have more options?

I have to document my API's. I have to use any one of them Slate Or Swagger. I want to know which one have more options, pros and cons, which one is better.
Sariban D'Cl
  • 2,197
  • 2
  • 28
  • 42
35
votes
6 answers

Enum in swagger

I'm wondering how to document enums in swagger. According to JavaDoc The dataType. See the documentation for the supported datatypes. If the data type is a custom object, set it's name, or nothing. In case of an enum use 'string' and…
Betlista
  • 10,327
  • 13
  • 69
  • 110
34
votes
5 answers

Spring REST API Documentation using Swagger

I am looking for a tool which could help me generate RESTful API documentation. My server is written in Java and uses Spring MVC framework. I do not have VIEWS in my server. It's a 100% RESTful service and all it does is consumes JSON and spits out…
jsf
  • 2,851
  • 9
  • 30
  • 33
34
votes
3 answers

No constructor for type SwaggerGenerator can be instantiated using services from the service container and default values

I'm trying to add Swagger to my project. The error received is as follows. No constructor for type 'Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator' can be instantiated using services from the service container and default values. Since I…
DonkeyBanana
  • 3,266
  • 4
  • 26
  • 65