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
28
votes
5 answers

How to generate OpenApi 3.0 spec from existing Spring Boot App?

I have a project (Spring Boot App + Kotlin) that I would like to have an Open API 3.0 spec for (preferably in YAML). The Springfox libraries are nice but they generate Swagger 2.0 JSON. What is the best way to generate an Open Api 3.0 spec from the…
ladyskynet
  • 297
  • 1
  • 3
  • 10
28
votes
2 answers

How to define constant string in Swagger open api 3.0

How to define constant string variable in swagger open api 3.0 ? If I define enum it would be like as follows "StatusCode": { "title": "StatusCode", "enum": [ "success", "fail" ], "type": "string" …
Harsha Gayan
  • 339
  • 1
  • 5
  • 13
28
votes
1 answer

django rest framework - How to add post parameters to api document(drf_yasg)?

x_param = openapi.Parameter('x', in_=openapi.IN_FORM, description='srring', type=openapi.TYPE_STRING) y_param = openapi.Parameter('y', in_=openapi.IN_FORM, description='string', …
SungHo Kim
  • 291
  • 1
  • 3
  • 11
28
votes
10 answers

How to fully disable swagger-ui in spring-boot?(/swagger-ui.html should return 404)

I have read following topic: Disabling Swagger with Spring MVC and I wrote: @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() …
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
28
votes
3 answers

Response model for specific status codes using Swagger

I am using Swagger to document my REST API (using asp.net web api 2). Is there a way in swagger to give response models for each possible responses for a given api call? I am annotating the status code response using the xml comments like so: …
Kaladin
  • 693
  • 2
  • 11
  • 20
28
votes
9 answers

how to add token auth to swagger + django rest framework?

I am using both great tools DRF and Django-REST-Swagger, however a few of my API views are under token authentication. So now I'd like to add to my swagger doc page of my API the possibility to test those token auth api urls, including the Token…
miguelfg
  • 1,455
  • 2
  • 16
  • 21
27
votes
2 answers

C# .net core swagger trying to use Multiple API Versions, but all end-points are in all documents

We are trying to separate our API versions into different Swagger documents. We have configured everything as described in https://github.com/domaindrivendev/Swashbuckle.AspNetCore#generate-multiple-swagger-documents. So we have configured two…
C. Molendijk
  • 2,614
  • 3
  • 26
  • 35
27
votes
2 answers

Swagger Codegen (with maven plugin) for OpenAPI 3.0

I want to use Swagger Codegen for OpenAPI 3.0 YAML file. And I see Swagger Codegen 3.0.0-rc0 is available. But when I try to use that I run into issues. Following are the details: My pom.xml file with swagger-codegen plugin:
Kuldeep Jain
  • 8,409
  • 8
  • 48
  • 73
27
votes
6 answers

How to generate a static html file from a swagger documentation?

I have created a Swagger documentation with a yaml file under: api/swagger/swagger.yaml Now I want to share a static HTML document with its definition, yet it was stated on the swagger project, that they don't plan to support HTML generation at…
k0pernikus
  • 60,309
  • 67
  • 216
  • 347
27
votes
3 answers

Should you Combine Swagger with HATEOAS/HAL/JSON-LD?

I am using Swagger for my ASP.NET Core API using Swashbuckle which describes my API in a separate document and provides a nice UI for all of this information. Are there any advantages of using something like HATEOAS, HAL or JSON-LD which modify the…
Muhammad Rehan Saeed
  • 35,627
  • 39
  • 202
  • 311
27
votes
3 answers

How to document websocket events or callback in swagger

I have a setup where it is possible to get some resource using standard REST and this is easy documented in swagger. The same resource is pushed to clients using websockets when it has changed, so clients does not have to do a pull on an interval…
27
votes
3 answers

Validation error: Data does not match any schemas from 'oneOf'

I'm getting the error Data does not match any schemas from 'oneOf' with the following spec: { "info": { "version": "1.0.0", "title": "REST API" }, "paths": { "/doit": { "post": { "responses": { "200": { …
Tim
  • 508
  • 1
  • 4
  • 8
27
votes
4 answers

Can Swagger be used for SOAP?

I was exploring Swagger and I must acknowledge I'm loving it. I understand Swagger is primarily for RESTful web services, but I was wondering if we can make it work with SOAP web services as well. May be translate SOAP based web services to RESTful?…
pavanlimo
  • 4,122
  • 3
  • 32
  • 47
27
votes
2 answers

Swagger With Static Documentation

I am looking to use Swagger to document my restful interface. The problem is that I do not want to automatically generate my documentation by annotating my code. Basically I don't want to couple my internal data model to the virtual data model…
Lee Jensen
  • 2,151
  • 2
  • 21
  • 23
26
votes
5 answers

Next.js with Swagger

Is there a way to have a swagger documentation for NEXT.js API routes? I'm using Next.js for both front-end and back-end development and I want to have a swagger documentation for the APIs I develop with Next.js.
Ehsan Shekari
  • 876
  • 2
  • 10
  • 19