Questions tagged [swagger-ui]

Swagger UI is a collection of HTML, CSS and JavaScript objects that dynamically generate documentation from a Swagger-compliant API

Swagger UI is part of the Swagger project.

It adds form to your APIs by making them look good and presentable so that client code can be written easily, at the same time it also makes documentation easier by integrating it with code.

It originated out of the Open API Specification. The source can be found here.

A sample Swagger UI can be found at the Pet Store.

4353 questions
50
votes
4 answers

Enable bearer token in Swashbuckle (Swagger document)

I created an asp.net webapi application which is using Individual Account Security so that the Bearer token is enabled by default. It's working fine so that I am able to test them in Postman without problem. Here comes the question when I'm trying…
Bagusflyer
  • 12,675
  • 21
  • 96
  • 179
46
votes
6 answers

How to generate swagger.json

I am using java spring boot framework to create REST api for my project and I am using "springfox-swagger2 and springfox-swagger-ui" for generating swagger documentation. I am able to see my documentation using the URL…
Bikesh M
  • 8,163
  • 6
  • 40
  • 52
46
votes
6 answers

Is there a way change the Controller's name in the swagger-ui page?

I'm using Swashbuckle to enable the use of swagger and swagger-ui in my WebApi project. In the following image you can see two of my controllers shown in the swagger-ui page. These are named as they are in the C# code, however I was wondering if…
XN16
  • 5,679
  • 15
  • 48
  • 72
45
votes
18 answers

Why does springfox-swagger2 UI tell me "Unable to infer base url."

Why does springfox-swagger2 UI tell me Unable to infer base url. As far as I know, I am using a typical Swagger spring-boot configuration. As you can see in the screenshot, the swagger-fox url backing the UI is example.com/api . NOTE: I get a…
djangofan
  • 28,471
  • 61
  • 196
  • 289
45
votes
14 answers

Swagger UI - " TypeError: Failed to fetch" on valid response

I've just pulled down the latest Swagger from the Git repo (3.0.19) using: https://github.com/swagger-api/swagger-ui.git and updated my API to use the new version. Ran git describe --tags to confirm and my version is currently:…
Hexie
  • 3,955
  • 6
  • 32
  • 55
41
votes
3 answers

Swagger UI shows error (validation) when deployed

I have the swagger ui embedded in my application. And when I run my node application locally the UI works great. However when I deploy the UI to my 'real' server I get an error image in the bottom right of my swagger ui: I am sure this is…
lostintranslation
  • 23,756
  • 50
  • 159
  • 262
37
votes
1 answer

How to refer to enclosing type definition recursively in OpenAPI / Swagger?

I'm writing an OpenAPI definition in Swagger Editor. One of my type definitions contains an array containing child elements of the same type as the parent. I.e. something like this: definitions: TreeNode: type: object properties: …
Morten
  • 684
  • 1
  • 5
  • 15
37
votes
7 answers

How to break swagger 2.0 JSON file into multiple modules

I'm trying to break my API document up into multiple JSON files that can be edited independently. All the examples I've been able to find use the Swagger 1.2 schema which has a "api":{} object for breaking it down. That appears to be missing from…
John P
  • 1,540
  • 2
  • 22
  • 34
36
votes
1 answer

How to embed Swagger UI into a webpage?

How to embed Swagger UI into a webpage? Basically I want an API endpoint test environment to embed into my webpage.
Akalanka Hewawasam
  • 490
  • 1
  • 5
  • 12
36
votes
3 answers

Spring + Springfox + Header Parameters

@RequestMapping(...) public Foo getFoo(@HeaderParam("header") final String header) { ... } Adding a @HeaderParam method parameter as above springfox picks it up and when I look at the swagger-ui it has a field for the header. This is exactly…
Jay Anderson
  • 937
  • 1
  • 8
  • 18
35
votes
11 answers

No operations defined in spec! - I get this error even though the swagger is setup and the end points are defined

I am trying to setup swagger on top of my node application using the swagger npm package. I have my end points and swagger setup perfect(atleast almost perfect), I did do quiet a lot of research on whats going wrong but I couldn't find the trace.…
Saranya Garimella
  • 465
  • 1
  • 5
  • 12
35
votes
6 answers

Spring Boot & Swagger UI. Set JWT token

I have a Swagger config like this @EnableSwagger2 @Configuration public class SwaggerConfig { @Bean public Docket api() { List schemeList = new ArrayList<>(); schemeList.add(new…
isADon
  • 3,433
  • 11
  • 35
  • 49
35
votes
4 answers

How to change basePath for Springfox Swagger 2.0

I'm running a service, where Swagger UI is accessible at: http://serviceURL/swagger-ui.html However, it is behind a proxy, such as: http://proxyURL/serviceName Generated URLs by Swagger UI are looking like: http://proxyURL/ instead of the actual…
Martin Asenov
  • 1,288
  • 2
  • 20
  • 38
34
votes
7 answers

Swagger UI - How can I expand all the operations by default?

All the operations appear collapsed when I open it and I want it to be expanded by default. Is there any property I need to change to achieve it? This is my swagger Bean: @Configuration @EnableSwagger2 public class SwaggerConfig { @Bean …
Gerardo Martínez
  • 793
  • 2
  • 12
  • 26
34
votes
3 answers

Swagger - Springfox always generates some response messages (401,403...) by default. How can I remove them?

I have controller as simple as this: @RequestMapping(value="/async/data", method=RequestMethod.GET, produces="application/json") @ApiOperation(value = "Gets data", notes="Gets data asynchronously") @ApiResponses(value={@ApiResponse(code=200,…
codependent
  • 23,193
  • 31
  • 166
  • 308