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

Configuring the Swagger codegen with Gradle. How does the provided Gradle script work?

I am doing battle with this code here: https://github.com/thebignet/swagger-codegen-gradle-plugin-example Trying to build a REST client using Swagger codegen and Gradle. I am new to Gradle and looking at this example is quite confusing as there are…
Boris Hamanov
  • 3,085
  • 9
  • 35
  • 58
4
votes
0 answers

Is it possible to generate model in multiple directories using Swagger codegen?

I use a swagger model (using Java JAX-RS) in multiple directory (package) structure. My target is to use the Swagger code generator in order to create the client code, having the model classes in different packages as well, using either name of the…
4
votes
0 answers

How to use swagger-editor and swagger-codegen docker images together in offline enviroment

I work in an offline environment and want to setup an instance of swagger-editor to share with the rest of the team. I want to leverage the swagger-codegen capabilities similarly to how https://editor.swagger.io/ has the "Generate Server" and…
4
votes
3 answers

How to enable SecurityDefinitions in "../v2/api-docs" json generated file

I want to use swagger client generator and feed the json generated by "../v2/api-docs" from the jHipster application. The problem is that without the security definitions the generated code will not work. The JWT token is not added to the API…
4
votes
1 answer

OpenAPI Generator / Swagger Codegen: How to add a function after all files have been generated

I'm trying to add a hook after all the files are created by the Go client generator and I'm wondering where I can add this. Right now, files are generated in this order (a) models (b) API paths (c) supporting files. If I hook into…
Grokify
  • 15,092
  • 6
  • 60
  • 81
4
votes
0 answers

[swagger-codegen][php-symfony] No entrypoint in generated code?

I am attempting to generate a php-symfony server stub using swagger-codgen but I am not getting an index.php (or app.php or anything like that). When I generate a server stub using the php-silex preset I get an index.php. If I google "silex…
Mike Furlender
  • 3,869
  • 5
  • 47
  • 75
4
votes
5 answers

Annotation needed from swagger codegen

I need a way to annotate my openapi 3 specification so that swagger-codegen will add an annotation to my java class, such as @JsonIgnoreProperties(ignoreUnknown = true) Is that possible? TIA!
JJeff
  • 129
  • 1
  • 2
  • 9
4
votes
1 answer

How to generate Java REST client from Spring REST Docs like it is generated from swagger.json?

My team used swagger for documenting REST API. As a QA engineer I was able to generate rest client from swagger.json that was published on remote server upon deploy and use the client for REST API integration testing. Now we are about to switch from…
ludenus
  • 1,161
  • 17
  • 30
4
votes
1 answer

How to handle org.springframework.core.io.Resource for Swagger Codegen

I am developing a web application using Spring Boot 2, which have 2 Spring projects working together: one is the REST API server serving the application logic via REST APIs, the other is the web project responsible for rendering web pages and…
asinkxcoswt
  • 2,252
  • 5
  • 29
  • 57
4
votes
2 answers

python swagger client set host and port

How should you specify host and port in the python client library auto-generated by swagger-codegen? The only documentation that I found is here.
Daniel Kats
  • 5,141
  • 15
  • 65
  • 102
4
votes
1 answer

How to generate models that have a variable whose data type is Currency(java.util) with Swagger Codegen

Is there a way to generate models that have a variable whose data type is Currency(java.util) with Swagger Codegen? Note: I use Swagger Version 2.0 and Swagger Codegen Version 2.2.3
séan35
  • 966
  • 2
  • 13
  • 37
4
votes
1 answer

How to generate spring cloud feign client using swagger-codegen-maven-plugin

I want to generate my feign client code using swagger-codegen, but I cannot find the docs which can lead me to do it. I have a microservice using spring cloud, several api-services using spring-cloud-feign interfaces to request the data.I wish that…
steven.tong
  • 345
  • 3
  • 16
4
votes
1 answer

how to generate URI parameter for dynamic feign basePath using swagger codegen?

I have a pretty simple question :) According to feign documents, they are supporting in changing the basePath of a feign client object dynamically by passing URI parameter trough the api function like so: GOOD Example: interface MyClient { …
dorony
  • 1,008
  • 1
  • 14
  • 31
4
votes
1 answer

CORS problems using generated [nodejs-server] code (SWAGGER)

I generated my server code (nodejs-server) based on the swagger specification I have. The problem is that when I try to hit the API from my UI (different domain), I'm getting the well know error that CORS is not enabled: XMLHttpRequest cannot load…
amp
  • 11,754
  • 18
  • 77
  • 133
4
votes
4 answers

How to customize swagger codegen to generate models that ignore null values

I'm using swagger-codgen to generate java model classes for my spring boot application and serialize them as json. By default these models would all include optional properties with null values. I would like to configure the swagger-codgen for…
samy
  • 1,396
  • 2
  • 19
  • 41