Questions tagged [openapi]

The OpenAPI Specification, originally known as the Swagger Specification, is a specification for machine-readable interface files for describing, producing, consuming, and visualizing RESTful Web services.

A variety of tools can generate code, documentation and test cases given an interface file. Development of the OpenAPI Specification (OAS) is overseen by the Open API Initiative, an open source collaborative project of the Linux Foundation.

Ref: https://en.wikipedia.org/wiki/OpenAPI_Specification

Related tags

4284 questions
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
16
votes
3 answers

Tell Swagger that the request body can be a single object or a list of objects

I am using Swagger with Scala to document my REST API. I want to enable bulk operations for POST, PUT and DELETE and want the same route to accept either a single object or a collection of objects as body content. Is there a way to tell Swagger that…
bennidi
  • 2,092
  • 21
  • 27
15
votes
1 answer

What is the difference beween summary and description in OpenApi?

I noticed that in OpenAPI Path Items and some other constructs you have both summary and description fields, what is the difference between those, and what is the purpose of each? For me, they seem to accomplish the same thing, and I did not find…
godzsa
  • 2,105
  • 4
  • 34
  • 56
15
votes
2 answers

Open API code generator Maven plugin uses old Swagger 2 annotations instead of Swagger 3 annotations

I'm using Open API code generator Maven plugin to generate Open API 3.0 from a file. I'm using this plugin in in my pom.xml: org.openapitools openapi-generator-maven-plugin 4.3.0 The…
Michael Dz
  • 3,655
  • 8
  • 40
  • 74
15
votes
3 answers

Allow anonymous access to springdoc-openapi-ui with Spring Security

How to allow anonymous access to springdoc-openapi-ui (OpenAPI 3.0 /swagger-ui.html) in a Spring Boot application secured by Spring Security?
Eugene Khyst
  • 9,236
  • 7
  • 38
  • 65
15
votes
1 answer

How to use OpenAPI 3.0 response "links" in Swagger UI?

I'm writing an Open API 3.0 spec and trying to get response links to render in Swagger UI v 3.18.3. Example: openapi: 3.0.0 info: title: Test version: '1.0' tags: - name: Artifacts paths: /artifacts: post: tags: -…
akagixxer
  • 1,767
  • 3
  • 21
  • 35
15
votes
2 answers

How to validate an HTTP requests against an OpenAPI3 specification in Python?

There seems to be number of Python libraries dedicated to validate the correctness of an OpenAPI schema. While this might be useful, I can frankly just write my OpenAPI schema here it in https://editor.swagger.io and have it validated / converted /…
pistacchio
  • 56,889
  • 107
  • 278
  • 420
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
8 answers

How to ask for additional GET parameters in an endpoint of api-platform using swagger docs?

I have a symfony project, where I use api-platform. I have an entity, and I have data providers for it. I am in trouble with definition of additional parameters for a collection endpoint. An entity is called suggestion. It has to return collection…
pedrouan
  • 12,762
  • 3
  • 58
  • 74
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
1 answer

How to generate OpenAPI v3 specification from Go source code?

Is there a way to generate OpenAPI v3 specification from go source code? Let's say I have a go API like the one below and I'd like to generate the OpenAPI specification (yaml file) from it. Something similar to Python's Flask RESTX. I know there are…
matusf
  • 469
  • 1
  • 8
  • 20
14
votes
4 answers

NestJS swagger generated docs do not show param information

I am working on a node.js server that uses the NestJS framework. I want to auto-build API documentation for the app using NestJS's swagger integration. Documentation generated correctly for my controller methods that the utilized @Body() approach…
GrantD71
  • 1,787
  • 3
  • 19
  • 27
14
votes
4 answers

springdoc-openapi generate openapi yaml on build without server

I have a Spring boot Gradle project and I want to get it's OpenAPI spec YAML file. As I understand the official swagger-core does not support Spring boot projects, thus I found springdoc-openapi…
ChikChak
  • 936
  • 19
  • 44
14
votes
3 answers

How to hide endpoints from OpenAPI documentation with Springdoc

Springdoc automatically generates a API documentation for all handler methods. Even if there are no OpenAPI annotations. How can I hide endpoints from the API documentation?
Matt Ke
  • 3,599
  • 12
  • 30
  • 49
14
votes
4 answers

How to omit null field from Swagger/OpenAPI in ResponseEntity?

I'm trying to omit null values in my ResponseEntity. My controller looks something like this: @RestController public class FooController { //fields //constructor @PostMapping public ResponseEntity
Edito
  • 3,030
  • 13
  • 35
  • 67