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

Spring Swagger UI: what is difference between io.swagger, io.springfox, and com.mangofactory

I am working on integrating the swagger UI with a spring boot MVC app and I am curious as to the differences between these libraries. I looked at each on mvnrepository.com and they are all done by different groups but seem to do the same thing. I…
Sakib
  • 1,503
  • 4
  • 26
  • 39
16
votes
2 answers

OpenAPI: what schema to accept any (complex) JSON value

The API for which I'm writing a Swagger 2.0 specification is basically a store for any JSON value. I want a path to read value and a path to store any JSON values (null, number, integer, string, object, array) of non-predefined depth. Unfortunately,…
dolmen
  • 8,126
  • 5
  • 40
  • 42
15
votes
1 answer

How to link to another endpoint in Swagger

I'm writing a Swagger specification for an future public API that requires a very detailed and clean documentation. Is there a way to reference/link/point to another endpoint at some other location in the swagger.yml file? For example, here is what…
AdrienW
  • 3,092
  • 6
  • 29
  • 59
15
votes
1 answer

How to define a mixed-type array (with different element types) in OpenAPI 2.0?

I trying to map the following JSON to an OpenAPI 2.0 (Swagger 2.0) YAML definition, and I am not sure how to set mixed array types into my schema: { "obj1": [ "string data", 1 ] } Now, my OpenAPI definition has: schema: object1: …
Rjk
  • 1,356
  • 3
  • 15
  • 25
14
votes
3 answers

Can we generate @JsonFormat on model variable using swagger-generater?

I have a variable in yml file startDate: type:string format:date I'm using swagger-generater to generate java code from yml. It's generating a startDate variable as below @JsonProperty("startDate") private LocalDate startDate = null; But I need…
0190198
  • 1,667
  • 16
  • 23
14
votes
1 answer

Swagger adding description to enums

I have a class that looks like this: public class Rule { private RuleType type; //enum private String value; } The enum is: public enum RuleType { TYPE_A, TYPE_B, TYPE_C; } Now each rule type the values are different. TYPE_A requires…
14
votes
5 answers

401 unauthorized page for swagger?

I am enable swagger2 by @EnableSwagger2. However, when I try to hit "/swagger-ui.html", it first hit my Authentication Filter. Then, I wrote the following code to bypass the authentication check String resourcePath = new…
Laodao
  • 1,547
  • 3
  • 17
  • 39
14
votes
3 answers

How can I specify the parameter for POST requests while using APIView with django-rest-swagger

In the latest version on Django REST Swagger (2.1.0) YAML docstrings have been deprecated. I cannot get swagger to show the POST request parameters. Here is my view class UserAuthenticationView(APIView): def post(self, request, *args,…
utkbansal
  • 2,787
  • 2
  • 26
  • 47
14
votes
2 answers

How do I specify multiple hosts in OpenAPI (Swagger)?

Right now my OpenAPI 2.0 YAML file has only one host URL: host: petstore.test.com basePath: / Can I use multiple hosts like this? host1: petstore.test.com host2: petstore1.test.com host3: petstore2.dev.com
user2598740
  • 141
  • 1
  • 1
  • 5
14
votes
5 answers

How to document OData endpoints (swagger, swashbuckle, other)?

What is the best way of documenting OData endpoints? Is there a way to use Swashbuckle for it?
free4ride
  • 1,613
  • 1
  • 18
  • 21
13
votes
1 answer

How to group FastAPI endpoints in Swagger UI?

I started programming using FastAPI framework and it comes with a builtin Swagger interface to handle requests and responses. I have completed nearly 20 APIs and its hard to manage and recognise APIs on Swagger interface. Someone told me to add…
Aryan VR
  • 189
  • 1
  • 12
13
votes
12 answers

swagger-ui.html page not working springboot

I am migrating my project which is based on springMVC to spring boot. it is a multi-module project. I am unable to get the swagger-ui.html up. I have added dispatcher servlet as follows: @Configuration public class DispatcherServletConfig…
Vaibhav Savala
  • 315
  • 2
  • 7
  • 17
13
votes
1 answer

Swagger: take one or more values from enum

I am writing an OpenAPI (Swagger) definition where a query parameter can take none, or N values, like this: /path?sort=field1,field2 How can I write this in OpenAPI YAML? I tried the following, but it does not produce the expected result: - name:…
MrNierda
  • 412
  • 1
  • 8
  • 19
13
votes
4 answers

swagger @ApiParam ignores certain properties

I have a Spring Boot Project with springfox-swagger2 2.7.0 And I have the following controller: @Api(tags = { "Some" }, description = "CRUD for Some Stuff") @RestController @RequestMapping(path = "/some") public class SomeController { …
Michiel Haisma
  • 786
  • 6
  • 17
13
votes
2 answers

Define array of multiple models in Swagger 2.0

This is my first foray into Swagger so please be gentle. I have the following definitions: definitions: Payload: type: object properties: indicators: type: array items: $ref: '#/definitions/Indicator' …
Jason Strimpel
  • 14,670
  • 21
  • 76
  • 106