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
12
votes
3 answers

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" My API produces JSON result, so Swagger UI displays the…
Prashant
  • 4,474
  • 8
  • 34
  • 82
12
votes
1 answer

Swagger 2.0: Multiple Path objects with different paths but same request and response

Due to some backward compatibility reasons, I need to support both the paths /ab and /a-b. The request and response objects are going to be the same for both of the paths. Can I have something like the following in my Swagger spec so that I do not…
bdev03
  • 375
  • 1
  • 4
  • 19
11
votes
3 answers

404 error on Swagger UI with Spring (springdoc-openapi configuration)

I am adding swagger UI to my Spring boot application. When I try to access the swagger-ui.html. I get the 404 error. Config class : @Configuration public class SwaggerConfig { @Bean public OpenAPI springShopOpenAPI() { return new…
peligrosa
  • 593
  • 1
  • 4
  • 8
11
votes
1 answer

Does `minLength: 1` imply required in OpenAPI spec?

Consider this OAS3 spec (testMinMax3.yaml): openapi: 3.0.1 info: title: OpenAPI Test description: Test license: name: Apache-2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html version: 1.0.0 servers: - url:…
Alex Ivanov
  • 393
  • 1
  • 5
  • 16
11
votes
1 answer

Is there a maxLength or an alternative keyword in OpenAPI 3

In openapis.org OpenAPI 3.0(https://spec.openapis.org/oas/v3.1.0), I am unable to find maxLength keyword to denote the max length allowed for a datatype nor an alternate. Can anyone help, do I need to do it with x-?
Vforquest
  • 121
  • 1
  • 2
  • 4
11
votes
4 answers

How can I generate Quarkus rest JX-RS service based on given openapi 3.0.3 yaml file

Currently I am developing an application using quarkus. I have an openapi yaml file that describes everything. I wanted to know if there are quarkus extensions or tool with which I can generate the rest end points that would produce and consume same…
Sandra
  • 419
  • 7
  • 17
11
votes
1 answer

Generate OpenAPI descriptions from JavaDoc

I have an application which provides an API with JAX-RS (Java API for RESTful Web Services / JSR-311). For documentation purposes I provide an URL according to the OpenAPI-Specification, which is generated by Eclipse MicroProfile OpenAPI. Everything…
Tobias Liefke
  • 8,637
  • 2
  • 41
  • 58
11
votes
2 answers

How do I fix OpenAPI error in seemingly correct 'inputSpec' for code generation?

I'm trying to run the OpenAPI generator, but I keep getting an error message that doesn't make sense. Failed to execute goal org.openapitools:openapi-generator-maven-plugin:5.0.0-SNAPSHOT:generate (default-cli) on project miguelmunoz.challenge: The…
MiguelMunoz
  • 4,548
  • 3
  • 34
  • 51
11
votes
4 answers

Java Spring Boot OpenApi 3 - How to add description for RequestBody?

I want to have a description for RequestBody in spring boot openapi 3 . so i make my code like this : @PostMapping(produces = "application/json", consumes = "application/json") public ResponseEntity addBook( @Schema( …
geeekfa
  • 1,169
  • 1
  • 10
  • 15
11
votes
2 answers

How to generate swagger documentation for aws-lambda python API?

I have an AWS-lambda based API, written in python. The data is in elastic search. The python code is basically an interface between the user and ES. I need to add swagger documentation. I can create the swagger.json file manually, but I would like…
eternal_student
  • 626
  • 4
  • 18
11
votes
1 answer

How to provide swagger annotation for MultipartFormDataInput in RestEasy with Quarkus

while working on Quarkus with the RestEasy framework, I have the functionality to upload a file using MultipartFormDataInput. This functionality is working as expected, but I am unable to provide proper open API annotation for swagger UI. I have…
Sambit
  • 7,625
  • 7
  • 34
  • 65
11
votes
1 answer

How does one setup OpenAPI redirect response with parameters?

I have an HTTP 302 (Redirect) that I implemented a new status parameter, that will append to the RedirectURL, so one can show a message something like if the call URL is passed as GET…
balexandre
  • 73,608
  • 45
  • 233
  • 342
11
votes
2 answers

OpenAPI / Swagger 3.0: Default discriminator value

How do you set a default discriminator for each child class? For example, take this schema: components: schemas: Pet: type: object required: - petType properties: petType: type: string …
11
votes
2 answers

Swashbuckle how to add OneOf declaration to OpenAPI 3

I have a request object that can be of 2 string types "A" or "B". Note: This is a simpler example of what I really want. An enum won't work for me here. public class SampleRequest { //Can only be "A" or "B" public string…
Dave Loukola
  • 650
  • 8
  • 14
11
votes
4 answers

How to generate swagger3 (OpenAPI3) spec in (.json/.yaml) from protobuf (.proto) files?

My original use-case: I am building an application in GO with a gRPC server (using protobuf), and wrapping it inside an HTTPS server (using gin). Only the HTTPS server is being published to the clients for use (by which I mean that my application…
Krishna Birla
  • 332
  • 2
  • 10