1,284 questions
152
votes
12
answers
334k
views
How to export swagger.json (or yaml)
How can I export a Swagger definition file? It should be a JSON or YAML file, e.g. swagger.json or swagger.yaml.
Let's say I have an endpoint looking like http://example.com//swagger/ui/index#!:
The ...
10
votes
1
answer
5k
views
How to allow any arbitrary query parameters using FastAPI and Swagger?
Note: This question is different from the one here, in that I need it to work with Swagger.
Given a FastAPI GET endpoint, I want to allow any arbitrary set of URL parameters, while maintaining Swagger ...
103
votes
25
answers
171k
views
How to configure Swashbuckle to ignore property on model
I'm using Swashbuckle to generate swagger documentation\UI for a webapi2 project. Our models are shared with some legacy interfaces so there are a couple of properties I want to ignore on the models. ...
140
votes
16
answers
309k
views
How to configure Spring Security to allow Swagger URL to be accessed without authentication
My project has Spring Security.
Main issue: Not able to access swagger URL at http://localhost:8080/api/v2/api-docs. It says Missing or invalid Authorization header.
Screenshot of the browser window
...
98
votes
4
answers
129k
views
Swagger Inheritance and Composition
In my "simplified" API, all responses are derived (inherit) from a base "response" class. The response class is composed of a header filled with metadata, and the body which contains the core data the ...
26
votes
2
answers
52k
views
How to return an array of objects in SwaggerHub?
I am defining an API specification in SwaggerHub using OpenAPI 2.0. The /contacts request returns an array of contacts. The definition is below:
/contacts:
get:
tags:
- contacts
...
39
votes
1
answer
34k
views
Swagger schema properties ignored when using $ref - why?
I'm trying to build a Swagger model for a time interval, using a simple string to store the time (I know that there is also datetime):
definitions:
Time:
type: string
description: Time in ...
58
votes
4
answers
50k
views
How to define mutually exclusive query parameters in Swagger (OpenAPI)?
I have a series of parameters in Swagger like this
"parameters": [
{
"name": "username",
"description": "Fetch ...
112
votes
2
answers
76k
views
Swagger/OpenAPI - use $ref to pass a reusable defined parameter
Let's say I've got a parameter like limit. This one gets used all over the place and it's a pain to have to change it everywhere if I need to update it:
parameters:
- name: limit
in: query
...
15
votes
1
answer
15k
views
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",
...
11
votes
1
answer
19k
views
How to send Authorization Header through Swagger UI using FastAPI?
In the frontend, I have the following JS function:
export const uploadFormData = async (
token: string,
email: string,
formInfo: Array<Object>,
): Promise<any> => {
...
189
votes
8
answers
389k
views
How to use 'Authorization: Bearer <token>' in a Swagger Spec
I am trying to convey that the authentication/security scheme requires setting a header as follows:
Authorization: Bearer <token>
This is what I have based on the swagger documentation:
...
28
votes
2
answers
29k
views
How to document dynamic query parameter names in OpenAPI (Swagger)?
Is there any way to document the following query?
GET api/v1/users?name1=value1&name2=value
where the query parameter names are dynamic and will be received from the client.
I'm using the latest ...
178
votes
6
answers
393k
views
What is the correct way to declare a date in an OpenAPI / Swagger-file?
What is the correct way to declare a date in a swagger-file object? I would think it is:
startDate:
type: string
description: Start date
example: "2017-01-01"
format: date
...
17
votes
3
answers
29k
views
How to add multiple example values for an array in OpenAPI/Swagger?
I am using Swagger OpenAPI Specification tool. I have a string array property in one of the definitions as follows:
cities:
type: array
items:
type: string
example: "Pune"...
88
votes
3
answers
106k
views
A 'simple' way to implement Swagger in a Spring MVC application
I have a ReSTFul API written in simple Spring (no Spring Boot, no fancy stuff!). I need to implement Swagger into this. So far, EVERY page on the internet has only driven me crazy with confusing ...
59
votes
4
answers
137k
views
Swagger: map of <string, Object>
I need to document with Swagger an API that uses, both as input and output, maps of objects, indexed by string keys.
Example:
{
"a_property": {
"foo": {
"property_1": "a ...
89
votes
2
answers
109k
views
How to format Swagger 2.0 text descriptions?
I would like to format my Swagger API descriptions so that they are not simple paragraphs of text. Preferably, I'd like to add a small table to it.
I did not find an online reference about text ...
46
votes
5
answers
43k
views
How to define global parameters in OpenAPI?
I'm preparing my API documentation by doing it per hand and not auto generated. There I have headers that should be sent to all APIs and don't know if it is possible to define parameters globally for ...
31
votes
1
answer
31k
views
How to write OpenAPI 3 (Swagger) specification for property name in `map` object?
The API I'm trying to describe has a structure where the root object can contain an arbitrary number of child objects (properties that are themselves objects). The "key", or property in the ...
24
votes
4
answers
58k
views
How to generate JSON examples from OpenAPI/Swagger model definition?
I'm building a fuzzer for a REST API that has an OpenAPI (Swagger) definition.
I want to test all available path from the OpenAPI definition, generate data to test the servers, analyse responses code ...
11
votes
5
answers
34k
views
RESTful API Testbed with Swagger
I'm trying to develop an automated testing suite for a REST API. I've been told that Swagger would be the right tool to use to do this.
The API is being developed using the Spring Framework.
I can't ...
1
vote
2
answers
9k
views
Cannot open Swagger UI in its Version 3 in my Spring Boot Example
I have a problem about opening swagger ui in my Spring Boot Example.
I get this kind of error when I access to localhost:8080/swagger-ui or localhost:8080/root-api-name:swagger-ui
Securing GET /...
48
votes
8
answers
89k
views
How do I combine multiple OpenAPI 3 specification files together?
I want to combine an API specification written using the OpenAPI 3 spec, that is currently divided into multiple files that reference each other using $ref. How can I do that?
29
votes
2
answers
18k
views
Manually set operationId to allow multiple operations with the same verb in Swashbuckle
I need to know if it's possible to set up custom operationid, or a naming convention, I mean I know that operation filter can be overwritten the way how operationId is generated
https://azure....