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

How do I set "Parameter content type" using Swashbuckle?

My swagger ui shows "Parameter content type" with various entries: "application/json-patch+json", "text/json", "application/json", and "application/*+json". I only want "application/json". There's a similar unsolved issue on the repo, which uses…
lonix
  • 14,255
  • 23
  • 85
  • 176
23
votes
2 answers

Secure swagger docs page with username and password Asp Net Core 2.1

I am using Asp.Net Core 2.1 Web Api with Swashbuckle.aspnetcore.swagger I want to secure api documentation page with username and password before granting access. Sample documention page To make sure its not accessible by the public
Joshua Leigh
  • 340
  • 1
  • 3
  • 8
23
votes
3 answers

Fluent Validation with Swagger in Asp.net Core

I am currently using Fluent Validation instead of Data Annotations for my Web api and using swagger for API documentation. Fluent validation rules are not reflected in swagger model as i am unable to configure fluent validation rules with swagger…
Mujahid Daud Khan
  • 1,983
  • 1
  • 14
  • 23
23
votes
6 answers

Show only selected controllers in swagger-swashbuckle UI

I am currently using swagger in my project and i have more than 100 controllers there. I guess due to the large number of controller, swagger UI documentation page takes more than 5 min to load its controller. Is it possible to select specific…
Subash Kharel
  • 478
  • 1
  • 3
  • 12
23
votes
4 answers

Springfox @RestController naming

I'm getting some minor troubles using Springfox. I can't set a name to @RestController classes. I'm using Spring boot and Swagger2. The following code will produce a controller named "rest-status-controller" in springfox ui. I've expected a…
Barium Scoorge
  • 1,938
  • 3
  • 27
  • 48
23
votes
3 answers

API key in header with swashbuckle

I want to do API key based authentication on a WebAPI project with Swashbuckle (swagger for .net). I have configured swashbuckle as below: config .EnableSwagger(c => { c.ApiKey("apiKey") .Description("API Key…
undefined
  • 33,537
  • 22
  • 129
  • 198
23
votes
3 answers

Django REST Framework + Django REST Swagger + ImageField

I created a simple Model with an ImageField and I wanna make an api view with django-rest-framework + django-rest-swagger, that is documented and is able to upload the file. Here is what I got: models.py from django.utils import timezone from…
jarussi
  • 1,491
  • 1
  • 13
  • 25
23
votes
1 answer

Can I indicate a regular expression requirement for a parameter value using Swagger?

In my REST API, one of the submitted parameter values must be a code following the regex: /[A-Z]{2}[0-9]{4}/ Is there any way, besides putting it in the description property of the parameter, for me to indicate that the value is not valid if it does…
Alan McBee
  • 4,202
  • 3
  • 33
  • 38
22
votes
2 answers

How to define enum mapping in OpenAPI?

I am designing an API and I want to define an enum Severity which can have values LOW, MEDIUM or HIGH. Internally Severity gets stored as an integer so I want to map these to 2,1 and 0 respectively. Is there a way to do this in an OpenAPI…
Yellowjacket
  • 548
  • 2
  • 7
  • 19
22
votes
4 answers

How to add summary and body manually in swagger nestjs

I am trying to add summary in my swagger documentation routes but I am not able to find the appropriate decorator for defining the summary. There are some routes in which I have not specified any DTO's. So, I would like to manually add request body…
Istiyak Tailor
  • 1,570
  • 3
  • 14
  • 29
22
votes
4 answers

How to remove swagger production .net core 2.1

I have swagger working on multiple microservices. When deploying to Azure we need to remove all together the option of swagger due to security best practices. Working with .net core 2.1 Looking for example of definitions.
Tzvi Gregory Kaidanov
  • 3,080
  • 3
  • 26
  • 33
22
votes
6 answers

How to generate a PDF or markup from OpenAPI 3.0?

I have an OpenAPI 3.0 spec and I want to generate a PDF out of it so that it can be given to the end users. Currently, tools like swagger-spec-to-pdf or swagger2markup only support Swagger 2.0 but not OpenAPI 3.0. Is it possible to generate a PDF…
Niranjan
  • 517
  • 2
  • 4
  • 21
22
votes
4 answers

OpenAPI (aka Swagger) in Azure Functions V2

I'm creating a V2 Function App and want to use Swagger/Open API for docs, however it is not yet supported in the Azure Portal for V2 Functions. Any suggestions on how I can use Swagger with V2 Functions in VSTS to create the docs on each build?
Albert
  • 255
  • 1
  • 2
  • 8
22
votes
7 answers

Asp.Net core Swashbuckle set operationId

How can I set swagger operationId attribute in Asp.Net Core 2.1 project? According to this post I should use SwaggerOperationAttribute but I cannot find it in Swashbuckle.AspNetCore library. Also there is an IOperationFilter public interface…
22
votes
2 answers

Generating Swagger Docs in Firebase Cloud Functions project

Is it possible to generate Swagger Spec file from function comments in firebase cloud functions? If so, how can we do it? I see the cloud functions code to be more like serverless, so wondering if this is possible.
Ayyappa
  • 1,876
  • 1
  • 21
  • 41