Questions tagged [swagger-codegen]

Swagger Code Generator allows the generation of API client libraries, server stubs and documentation by an (Swagger) OpenAPI specification.

Swagger Code Generator allows the generation of API client libraries, server stubs and documentation by an (Swagger) OpenAPI specification.

It can be executed as Maven plugin or directly on the commandline. A wide range of programming languages and various libaries are already supported. Its template engine enables users to add their own generators for other languages or custom implementations.

Use this tag for all questions regarding the generation, its template engine, the usage of the cli.

Useful links

982 questions
3
votes
3 answers

How to create a swagger:response that produces a binary application/pdf file?

I'm failing in getting a file download working in swagger, connexion, openapi3. Within the openapi specification I've defined the following path: /lab/samples/list/pdf: get: summary: download pdf file operationId: get_sample_pdf responses: …
3
votes
0 answers

Code generation coplex input parameter in WebApi suing Swashbuckle and NSwag

I’m using Swashbuckle 5.6 to generate OpenAPI specification and Nswag 13.7.3 to generate c# client and models. I’m wondering is it currently possible to generate client method from this kind of controller (GET with query parameters) public class…
dnf
  • 1,659
  • 2
  • 16
  • 29
3
votes
1 answer

ResponseEntity return type wildcard with swagger generated interface

I want to know the difference between returning ResponseEntity with wildcard VS ResponseEntity as return type when Swagger generated API interface contains 2 different classes as return types, i.e one for an exception and another for…
user1354825
  • 1,108
  • 4
  • 21
  • 54
3
votes
1 answer

Swagger OpenAPI v3 file download issue (SpringBoot)

How can I download a file using Swagger OpenAPI v3 implementation? I am not able to figure out how to return the actual file content back in the response through my controller. Its literally straightforward without the use of OpenAPI, but here I…
Kishore
  • 31
  • 1
  • 4
3
votes
0 answers

Disable springfox with swagger-codegen

I'm using io.swagger.codegen.v3.swagger-codegen-maven-plugin, version 3.0.18 to generate code from openapi 3 yaml. But, when it's generated, it creates a springfox with swagger 2 configuration. I want to remove springfox, but I don't know how. I…
albertinizao
  • 75
  • 2
  • 5
3
votes
0 answers

Migrating Net Core 2.0 API to Net Core 3.1

I am upgrading my ASP NET Core API from 2.0 to 3.1 in process I need to upgrade the swagger to 5.0 which brings lot of changes. One I am stuck with is an Controller that Handles file upload, Earlier public class FileUploadOperation :…
3
votes
2 answers

Use LinkedHashMap instead of HashMap for Swagger dictionary type (Java codegen)?

I'm using openapi 3.0.2, and the codegen plugin: io.swagger.codegen.v3 swagger-codegen-maven-plugin 3.0.14 I'm using the swagger dictionary/hashmap type described…
rmf
  • 625
  • 2
  • 9
  • 39
3
votes
1 answer

Swagger: Structural error at should have required property 'paths' missingProperty: paths - extracting common components to external swagger file

I have several yaml files in which many components are the same. For example I have 10 Language.java files with classes in different packages generated therefore I cannot write universal converters in code and I have some copy paste code in…
michealAtmi
  • 1,012
  • 2
  • 14
  • 36
3
votes
1 answer

NullPointer exception while generating code using swagger codegen for openapi 3.0

Facing issue of NullPointer while generating code through swagger codegen. I am new to gradle and have updated build.gradle to reflect latest changes required to generate the code for the given API spec. Please provide your valuable inputs. My…
Bilbo Baggins
  • 2,899
  • 10
  • 52
  • 77
3
votes
0 answers

GrapeSwagger::Errors::UnregisteredParser: No parser registered for String

I'm adding a Rails API using Grape where the success type should be String. When I do this the swagger_doc no longer generates as there is no parser registered for String. How do I register a String parser? Thanks to anyone that can help! Below is…
Beatrice
  • 76
  • 9
3
votes
3 answers

Add custom annotation when generate backend code with swagger codegen

I'm trying to generate sever code with swagger codegen. In my model have some custom annotation like @Currency @Target({ METHOD, FIELD, ANNOTATION_TYPE, PARAMETER }) @Retention(RUNTIME) @Size(min = 3, max =…
Park Jay
  • 249
  • 6
  • 14
3
votes
1 answer

Swagger-ui flattens object in query params, but the generated angular client doesn't

I have the folloging Rest function in my spring boot application @SecuredMaster @GetMapping(path = "/mitarbeiter") @Operation(security = {@SecurityRequirement(name = "jwt")}) public Page getMitarbeiter(Pageable pageable,…
wutzebaer
  • 14,365
  • 19
  • 99
  • 170
3
votes
1 answer

Maven Swagger swagger-codegen-plugin only generate model and controller

I'm using maven-codegen-plugin just to generate from my yml file the interface for the controller and model files. This is a java spring-boot proyect. The pluging Configuration: io.swagger
3
votes
1 answer

How to specify possible values of map keys using annotations

As Swagger Specification says there is a way explicitly to define fixed keys as object properties (see "Fixed Keys" section). How to achieve the same thing using Swagger annotations? E.g. @ApiModelProperty(required = true) private Map
Stanislau
  • 402
  • 1
  • 5
  • 16
3
votes
0 answers

OpenApi (Swagger 3.0) Codegen is missing validations

I have a basic problem with openapi maven codegen plugin. Validations annotation (maxLength, pattern) is missing in the java generated code. Here is my pom: org.springframework.boot
Nav
  • 4,450
  • 10
  • 53
  • 84