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

Swagger generate subtypes based on enum value

I have the following structure Notification | ------------------------ | | SmsNotification EmailNotification The Notification contains an enum notificationType…
Ivar Reukers
  • 7,560
  • 9
  • 56
  • 99
5
votes
2 answers

OpenApi Generator reference an external POJO in YAML file specification

I'm using OpenApi v3.3.4 (formerly called Swagger CodeGen) maven plugin to generate my rest controller via api.yml files where I describe all the operations I want to expose. In my use case, I want to expose a method POST:…
Ghassen
  • 591
  • 1
  • 15
  • 33
5
votes
0 answers

Generating Enums with ng-swagger-gen

I want to generate models in Angular application from SpringBoot Rest services and for this purpose I use ng-swagger-gen plugin. But somehow, the Enums are generated only as inline String values and not the Enum class so everytime I must either type…
troger19
  • 1,159
  • 2
  • 12
  • 29
5
votes
5 answers

Why discriminator property gets serialized twice?

I'm using OpenAPI 3.0 inheritance in components schemas and I have the (Java) classes generated by openapi-generator (which uses Jackson). Why the discriminator property gets serialized twice in the resulting JSON? This is a JHipster API-First…
5
votes
4 answers

Swagger Codegen For Nestjs

I have created apis endpoint with Swaggerhub and successfully exported to run with asp.net core. I want to test the same apis with nestjs but i found documenting with openapi but not the other way round; convert yaml to nodejs.Is there a way to…
phonemyatt
  • 1,287
  • 17
  • 35
5
votes
0 answers

Is there a swagger-codegen extension that generates asynchttp clients in java?

I am trying to use swagger-codegen for the first time to automatically generate java clients for my REST service. I downloaded the the cli and ran this command: java -jar ~/Downloads/swagger-codegen-cli-2.2.1.jar generate \ -i…
5
votes
0 answers

swagger.yaml: how to generate a ResponseEntity with `InputStreamResource` type。

I am using swagger-codegen to generate JAVA class. I want to generate a class with ResponseEntity with ResponseEntity . For example: ResponseEntity pmml(@RequestParam(value = "modelUuid") String…
egg
  • 211
  • 1
  • 2
  • 10
5
votes
1 answer

Swagger reference to definitions in externalFile

I have many swagger files, using the same definitions. I want to move this definitions to a separate file and reference them. Main swagger file looks like: swagger: '2.0' info: version: 1.0.0 basePath: /api tags: - name: MyClient schemes: -…
Ermintar
  • 1,322
  • 3
  • 22
  • 39
5
votes
1 answer

How to define enum values in String using Swagger Codegen

I am using SwaggerCodegen(2.3.1) to generate the client code of my APIs. I've used enum as part of YAML definition file, after which Swagger generates the java file. random: enum: - A - B - C+ - C- type: string This yml…
Himanshu Arora
  • 688
  • 1
  • 9
  • 20
5
votes
0 answers

How to accept self-signed certificates when generating OpenAPI clients?

I have a rest service that is documented with OpenAPI 2.0. It is secured via a self-signed ssl-certificate, which cannot be replaced, because it is highly likely, the service will run on localhost in production. I generate a client from the OpenAPi…
tgr
  • 3,557
  • 4
  • 33
  • 63
5
votes
1 answer

swagger-editor vs swagger-codegen

I am a newbie to swagger and I have been trying to develop api's using swagger-editor. Swagger-codegen states that is an open source code-generator to build server stubs and client SDKs directly from a Swagger defined RESTful API. When I work with…
Sarageorge
  • 129
  • 9
5
votes
1 answer

Swagger client codegen does not include optional methods

I am using swagger codegen (on this Zoura swagger) to create a Java/rest template client. I am using the swagger Gradle plugin: id "org.hidetake.swagger.generator" version "2.11.0" Here is the config for it: { "library": "resttemplate", …
codesalsa
  • 882
  • 5
  • 18
5
votes
0 answers

Need to publish swagger-codegen generated jar file to maven

I am facing some issues with the gradle plugin to deploy/publish the jar which is generated by swagger-codegen plugin. I already looked at this question and my needs are completely different but it is acting like this. It is deploying the jar…
Aditya Peshave
  • 667
  • 9
  • 26
5
votes
1 answer

Springfox Swagger Ui from existing JSON

I have a gradle backed SpringBoot application where we were originally just creating our REST controllers and then using the @EnableSwagger2 annotation to create our swagger UI. This was working just fine, but now we want to transition to an API…
SpaceGerbil
  • 224
  • 4
  • 14
5
votes
1 answer

How to define enum values in array or enum as key in map property?

I am using swagger-codegen-maven-plugin (2.2.1) to generate java and typescript code class files from YML configuration. I have two questions. How to define array of enum property in YML? How to define map property enum as key and boolean as value…
nayakam
  • 4,149
  • 7
  • 42
  • 62