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

How to specify examples for GET parameters in Swagger?

I'm using the online Swagger Editor to create a Swagger spec for my API. My API has a single GET request endpoint, and I'm using the following YAML code to describe the input parameters: paths: /fooBar: get: tags: - foobar …
Devdatta Tengshe
  • 4,015
  • 10
  • 46
  • 59
22
votes
3 answers

Swagger Codegen CLI Java Client - How to use it right

I'm currently playing around with my jersey2 rest service. For a better overview of the given service (description, types and so on) I make heavily use of swagger (swagger-jersey2-jaxrs). So I'm able to genereate my service description…
Matthias
  • 400
  • 1
  • 4
  • 13
22
votes
2 answers

Swagger require all properties

Given the following schema definition (which is a valid way to define required properties): MySchema: type: object required: [property1, property2, property3] properties: property1: type: integer property2: type: integer property3: …
JeB
  • 11,653
  • 10
  • 58
  • 87
22
votes
9 answers

How to redirect from root url to /swagger/ui/index?

I have a WebApi project with Swashbuckle installed onto it. In default setup, I must open in browser http://localhost:56131/swagger/ui/index to view my operations description and test page. I want it to be accessible from root of the site:…
v.karbovnichy
  • 3,183
  • 2
  • 36
  • 47
22
votes
3 answers

Swagger 2.0 where to declare Basic Auth Schema

How do I define basic authentication using Swagger 2.0 annotations and have it display in swagger UI. In the resource I have: @ApiOperation(value = "Return list of categories", response=Category.class, responseContainer="List", httpMethod="GET",…
mad_fox
  • 3,030
  • 5
  • 31
  • 43
22
votes
4 answers

How to send Authorization header with a request in Swagger UI?

I have a ASP.NET Web Api 2 application. I added Swashbuckle to it (Swagger for .NET). It displays my endpoints no problem, but in order to send a request I need to attach an Authorization header to that request. If I understand correctly in order to…
Marta
  • 1,132
  • 1
  • 10
  • 26
22
votes
2 answers

Exclude Models or properties from swagger response

I used swagger in my apache cxf project , used @Api and @ApiOperations and @ApiParam annotations and generated a api doc for the rest services. But I want to exclude some of the fields like EntityTag, StatusType and MediaType etc from Models…
LazyGuy
  • 715
  • 4
  • 12
  • 27
22
votes
2 answers

How do I get started with swagger-ui

What is swagger-ui and what is the use of it? I have visited http://swagger.io/, but I need more information. Please guide me.
22
votes
9 answers

How to hide a parameter in swagger?

did anyone succeed to hide a parameter from generated documentation? I found an issue here, but using @ApiParam(access="internal", required=false) before @HeaderParam did not seem to work.
eugen-fried
  • 2,111
  • 3
  • 27
  • 48
21
votes
2 answers

Using Swashbuckle 5.x specify nullable = true on a Generic T Parameter reference property

I recently upgraded my API to a .net core 3.1 server using Swashbuckle 5 with the newtonsoft json nuget, which produces an openapi 3 schema. I then use NSwag to generate a C# API. Previously I had a .net core 2.2 server with swashbuckle 4, producing…
Adam Diament
  • 4,290
  • 3
  • 34
  • 55
21
votes
3 answers

springdoc-openapi apply default global SecurityScheme possible?

I have the following SecurityScheme definition using springdoc-openapi for java SpringBoot RESTful app: @Bean public OpenAPI customOpenAPI() { return new OpenAPI() .components(new…
Cortlendt
  • 2,190
  • 4
  • 29
  • 50
21
votes
3 answers

Displaying of FastAPI validation errors to end users

I'm looking for some library or example of code to format FastAPI validation messages into human-readable format. E.g. this endpoint: @app.get("/") async def hello(name: str): return {"hello": name} Will produce the next json output if we miss…
imbolc
  • 1,620
  • 1
  • 19
  • 32
21
votes
3 answers

Difference between Swagger & HATEOAS

Can anyone explain the difference between Swagger & HATEOAS? I have searched this question many times but nobody has provided a proper, detailed answer differentiating these two aspects.
sanket jaiswal
  • 243
  • 1
  • 4
  • 8
21
votes
6 answers

Swagger running with local json file in Docker Image

So, I wanted to run the local Swagger UI with respect to Local Json. And for that I am following the instructions available here: Here is the command that is being shared in that documentation: docker run -p 8081:8080 -e…
Ankur Verma
  • 5,793
  • 12
  • 57
  • 93
21
votes
1 answer

OpenAPI multiple types inside an array

I'm having trouble defining a reusable schema component using OpenAPI 3 which would allow for an array that contains multiple types. Each item type inherits from the same parent class but has specific child properties. This seems to work alright in…
Bobbake4
  • 24,509
  • 9
  • 59
  • 94