Questions tagged [swagger-2.0]

Swagger is a specification and framework implementation for describing, producing, consuming, and visualizing RESTful web services. Swagger 2.0 is the current generation of the spec and includes many improvements over 1.X. This specification is now known as Open API 2.0.

Read more about Swagger 2.0 here.

Learn about how to migrate from 1.x to 2.0 here.

1666 questions
13
votes
2 answers

Include cookie in swagger doc requests

My web service API will check whether a certain cookie is included in the requests, but I couldn't figure out how to include a cookie to my swagger doc api calls. I've tried two approaches: Adding cookie as a editable field like this in my .yaml…
Li-Fan Yu
  • 305
  • 1
  • 3
  • 8
13
votes
2 answers

Swagger Editor integration to Git or GitHub

I'm currently using the Swagger Editor locally in my network. Is there any possibility that the editor can import a file directly from a git server? I'm defining an API and I would like to have that in git, not only to have it secure but to…
Mario
  • 153
  • 1
  • 9
12
votes
1 answer

What is the difference between global definitions section and components section?

What is the difference between the global definitions section and the components section in Swagger 2.0? I came across a Swagger definition YAML file which is marked as swagger: '2.0'. It has one section called definitions just below parameters.…
user3754482
  • 161
  • 2
  • 8
12
votes
2 answers

Hide swagger bad response example model in net core 2.2

I upgrade my netcore 2.1 project to 2.2 and i have a problem with my swagger page. Previously in swagger bad response it only show "Bad Request" without the model. But after i upgraded to net core 2.2 there is a model shown in the bad request…
capudang
  • 403
  • 4
  • 10
12
votes
3 answers

serve swagger.json from resource class

I use swagger for documenting endpoints of a resteasy API, and I serve the swagger.json description using a servlet with a method like this: public void init(ServletConfig config) throws ServletException { super.init(config); BeanConfig…
user1981275
  • 13,002
  • 8
  • 72
  • 101
12
votes
1 answer

Swagger 2.0: Multiple Path objects with different paths but same request and response

Due to some backward compatibility reasons, I need to support both the paths /ab and /a-b. The request and response objects are going to be the same for both of the paths. Can I have something like the following in my Swagger spec so that I do not…
bdev03
  • 375
  • 1
  • 4
  • 19
12
votes
1 answer

Swagger array of integer return type

I'm just getting started with using the swagger-editor to define my RESTful API and I'm confused on the responses. Many of my methods simply return an array of integers, and I'm not understanding how to specify that in the YAML.
Gargoyle
  • 9,590
  • 16
  • 80
  • 145
12
votes
2 answers

Swagger migration from 1.2 to 2.0 specification

I have Swagger 1.2 JSON spec which I wanted to migrate to Swagger 2.0. Can someone help with that?
Rohit Goyal
  • 425
  • 1
  • 6
  • 13
12
votes
2 answers

Swagger 2.0 Anyof

What is the equivalent of anyof in Swagger version 2.0, Please tell me how to update my json file because I want to upgrade my documentation from swagger 1.0 to 2.0. Thank You for your Help.
Mohcine Aterhzaz
  • 173
  • 1
  • 3
  • 12
11
votes
7 answers

XML comments are not shown in Swagger documentation, is this bug in swagger?

The Swagger xml comments are not showing in the doc UI, not sure i am missing something here.. atleast someone direct me that this is a bug Step1: Create a new brand new ASP.NET web application Web API project Step2: Created a Web API…
ram4sof
  • 365
  • 1
  • 4
  • 14
11
votes
2 answers

Should Internal error (500) be part of Swagger API documentation?

As far as I checked on many swagger files of Amazon/Google and more, That error code (or generally error codes of 5xx family) is not shown as a part of the swagger files. Is their a reason for that? I am asking because one of our microservices API…
yoka791
  • 576
  • 5
  • 17
11
votes
3 answers

How to change Swagger-ui URL prefix?

I am using Springfox Swagger2 with Spring boot 1.5.9. I can access swagger UI on this link. http://localhost:8090/swagger-ui.html How can I change it to be available on following…
Ravi Gupta
  • 189
  • 1
  • 2
  • 7
11
votes
1 answer

configure swagger-ui with maven

I am integrating my JAX-RS REST project with Swagger. I read many documentation and tutorials and my favourite figure is the following (thanks to Philipp Hauer's blog): That image helped me a lot to understand how Swagger works. After I have…
zappee
  • 20,148
  • 14
  • 73
  • 129
11
votes
6 answers

.NET Core 2 and SwashBuckle Swagger UI is not Displaying

I have followed a few tutorials and have gotten this to work at work but for some reason I am not able to get the UI to display but the Swagger Json is created. Last tutorial I looked at is here. My setup is like so: Nuget Package:…
11
votes
4 answers

Customizing Request Header description in Swagger UI using Springfox-Swagger2

I am using Springfox Swagger2 version 2.4.0, Springfox Swagger UI version 2.4.0 and Swagger Annotations version 1.5.0 in my Spring Boot application. The question here is, I am able to generate swagger UI for my controller's API and I am able to test…
Gandhi
  • 11,875
  • 4
  • 39
  • 63