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

Using OpenAPI operation filters to add security requirements to controller endpoints that require authentication

I am trying to improve my projects openapi definition by adding security requirements to endpoints that require authentication. An endpoint requires authentication if it is a method of a class with the [Authorize] decorator, and lacks a…
Liam S. Crouch
  • 167
  • 1
  • 10
2
votes
1 answer

How does one indicate that a number is prohibited for use in swagger documentation?

I am trying to specify a property in my swagger documentation called myNumber, which can be any integer in [-1, 10] except 0. This is what I have so far: myNumber: type: integer description: You can use any number in [-1, 10] except 0. …
yalpsid eman
  • 3,064
  • 6
  • 45
  • 71
2
votes
1 answer

How to generate a Node Rest API Client based on OpenAPI Spec 3.0

I'm a node/JS beginner, so really sorry if I missed something. My Need is the following, I have a Swagger/OpenAPI3.0 yaml file describing an API that I need to consume. As the client will be an Node API gateway, I want this API Client code for…
Matt
  • 21
  • 1
2
votes
1 answer

How to reference another schema from an array schema in OpenAPI 3.0?

I have an OpenAPI 3.0 schema where one of the properties (the taskRequireSkills array) needs to reference another schema (TaskRequireUserSkill), like this: components: schemas: Task: properties: id: type: integer …
Petro Gromovo
  • 1,755
  • 5
  • 33
  • 91
2
votes
0 answers

Is there a way to automatically generate the java test code using swagger codegen?

I've been playing with swagger codegen for a springboot project. I am now able to automatically generate the client code in java, ignore the generation of the data models (importing my own in the swagger-codegen-maven-plugin via…
2
votes
1 answer

How to define two different responses for same Response code with 302 Redirect?

I'm trying to set two different responses of 302 in out API since our API redirects to a different Endpoint depending on the request sent. I'm current using Open API ver 3.0.1. How do I do that? I basically just want two different Location Headers…
iamjoshua
  • 1,157
  • 3
  • 16
  • 33
2
votes
0 answers

How do I add an optional global request header to openapi/swagger 3 documentation in Spring Boot?

I have a spring boot project that uses openapi/swagger 3 annotations for documentation. Since the project is behind a Zuul gateway, there is some pre-processing of requests before they reach specific REST endpoints. Some of that pre-processing is…
Matt
  • 31
  • 1
2
votes
2 answers

How to expose additional models : Migrating from Springfox to Springdoc

I need to expose some models which don't used directly in REST API methods. With springfox I used Docket's additionalModels method to programmatically add models to specification: docket.additionalModels( typeResolver.resolve(XModel1.class), …
aldan95
  • 21
  • 1
  • 4
2
votes
0 answers

Where to place Model / Property Permissions

This question pertains to OpenAPI 3.0.0 Have a need to specify Create, Read, Update and Delete permissions as pertains to models and properties. To be specific, some of our permissions are defined on the models/properties and although there is a…
ttugates
  • 5,818
  • 3
  • 44
  • 54
2
votes
0 answers

Swagger-PHP/Doctrine annotations, OpenAPI 3 and JSON:API format

Can anyone tell me if OpenApi 3 supports a JSON:API format? I have been looking around and can't really seem to figure out if it is supported. Currently I am using CakePHP 3.6 and Swagger-php/doctrine annotations to create OA3 documentation. Thanks…
ev8dev
  • 31
  • 6
2
votes
2 answers

How to update NestJS Swagger module but use OpenAPI 2.0(Swagger)?

We are making an API in Node.js/Typescript with NestJS framework. We use @nestjs/swagger package to make it conform to OpenAPI(formerly known as Swagger). It is inteneded to be used with Azure/autorest to generate client code. Autorest supports…
Gherman
  • 6,768
  • 10
  • 48
  • 75
2
votes
2 answers

How to generate RequestBody of type Map using springdoc for swagger open api 3.0?

For the following code, only Parameter id is getting generated and its completely missing the "Request body" section. I added type="object" based on https://swagger.io/docs/specification/data-models/dictionaries/ . public Item addProperties( …
2
votes
1 answer

springdoc-openapi generic controller type parameters support

I have the following controller code: public abstract class BaseController { @Operation @GetMapping Page get() } @Data public abstract class BaseClientModel { …
Cortlendt
  • 2,190
  • 4
  • 29
  • 50
2
votes
1 answer

Custom OpenApi documentation with Spring Boot

I have followed this documentation to integrate an OpenAPI/swagger document with Spring WebFlux: https://www.baeldung.com/spring-rest-openapi-documentation I'd like to generate a custom OpenApi document at runtime. I have attempted to serve a custom…
Cheetah
  • 13,785
  • 31
  • 106
  • 190
2
votes
0 answers

swagger-annotations @Schema does not provide a means to define properties

I am using swagger-annotations:2.1.1. According to swagger.io specs a configuration for a multipart file-upload would be: "requestBody": { "content": { "multipart/form-data": { "schema": { "type":…