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
26
votes
3 answers

How to annotate array of objects response in Swagger

I have to debug a REST API Java project that has been developed using Swagger.I'm new to it, so I'm a little bit confused on how to do certain things. For example, here's one…
Fel
  • 4,428
  • 9
  • 43
  • 94
26
votes
4 answers

what does Swagger server stub mean?

What does the term Server Stub mean in the context of the Swagger ecosystem? How is it used?
Mo Haidar
  • 3,748
  • 6
  • 37
  • 76
26
votes
2 answers

How to document dynamic query parameter names in OpenAPI (Swagger)?

Is there any way to document the following query? GET api/v1/users?name1=value1&name2=value where the query parameter names are dynamic and will be received from the client. I'm using the latest Swagger API.
Sharad Ahire
  • 758
  • 2
  • 16
  • 32
26
votes
2 answers

Swagger definition for firebase authentication

Could anyone provide a working sample of a Swagger security definition for firebase authentication? On the backend, firebase ID token is verified using the firebase admin SDK: import * as admin from 'firebase-admin'; await…
26
votes
5 answers

Swagger default value for parameter

How do I define default value for property in swagger generated from following API? public class SearchQuery { public string OrderBy { get; set; } [DefaultValue(OrderDirection.Descending)] public OrderDirection…
Liero
  • 25,216
  • 29
  • 151
  • 297
26
votes
1 answer

How to write OpenAPI 3 (Swagger) specification for property name in `map` object?

The API I'm trying to describe has a structure where the root object can contain an arbitrary number of child objects (properties that are themselves objects). The "key", or property in the root object, is the unique identifier of the child object,…
user2152081
  • 777
  • 1
  • 9
  • 17
26
votes
2 answers

How to return an array of objects in SwaggerHub?

I am defining an API specification in SwaggerHub using OpenAPI 2.0. The /contacts request returns an array of contacts. The definition is below: /contacts: get: tags: - contacts summary: Get all the contacts …
Krishna Adhikari
  • 357
  • 1
  • 4
  • 9
26
votes
2 answers

"discriminator" in polymorphism, OpenAPI 2.0 (Swagger 2.0)

Referencing OpenAPI 2.0, Schema Object, or Swagger 2.0, Schema Object, and the definition of discriminator field as: Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema…
Musa Haidari
  • 2,109
  • 5
  • 30
  • 53
26
votes
2 answers

How to generate swagger.json using gradle?

I want to use swagger-codegen to generate REST clients and possibly static HTML documentation. However, swagger-codegen needs swagger.json for input. I am aware, that I can get this from a running REST server equipped with Swagger. But is there a…
tbsalling
  • 4,477
  • 4
  • 30
  • 51
26
votes
2 answers

Configure Swagger javax validation Constraints on DTOs

I'm using Swagger (1.5.8). I want my swagger.json definition to detect the javax.validation JSR-303 annotations on my DTOs, so that I can document my API's validation constraints. I would expect a @Min annotation (like this example) would show…
JJ Zabkar
  • 3,792
  • 7
  • 45
  • 65
26
votes
3 answers

Using Javadocs to generate Swagger document

I want to build the Swagger documentation for an existing set of RESTful APIs. I have the following requirement: Generate Swagger Doc offline (I used http://kongchen.github.io/swagger-maven-plugin/). This plugin helps me to generate the Swagger…
Raj
  • 1,119
  • 4
  • 21
  • 41
25
votes
1 answer

Is it possible to be in try-it-out mode by default in Swagger 2?

I am using Swagger 2 with Springfox. When you click on an endpoint, is there any way to have the Try-it-out mode activated by default, without having to click this button:
Thomas
  • 1,491
  • 13
  • 23
25
votes
1 answer

Multi-level (nested) tagging in Swagger UI

I just started working on Swagger 2.0 API recently. I am looking for some ways to organize the API documentation. Currently I'm using the @Api(tags = {"Heading1"}) Java annotation to tag each API. The generated documentation looks…
kani mozhi
  • 251
  • 1
  • 3
  • 3
25
votes
7 answers

Spring Boot Swagger 2 Configuration Error creating bean with name 'documentationPluginsBootstrapper'

I have problems with configuration of Swagger in my Spring Boot project. I was following the basic instruction for this, and somehow it doesn's work. Here it is: pom.xml io.springfox
wegtis
  • 303
  • 2
  • 4
  • 12
25
votes
2 answers

Manually set operationId to allow multiple operations with the same verb in Swashbuckle

I need to know if it's possible to set up custom operationid, or a naming convention, I mean I know that operation filter can be overwritten the way how operationId is…