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
0 answers

How to integrate OAuth with Swagger Codegen

I am using the Swagger Generator website to generate the code for an API in Java. The API specifications are public and available here. As you can see, seems like the JSON doesn't have any Authentication configuration in it, but the API actually…
gbos
  • 503
  • 2
  • 6
  • 28
4
votes
1 answer

Why does Swagger CodeGen 3.0.x generates classes with AllOf[Classname]

I'm using swagger codegen 3.0.21 for generating a C# api client. The generators creates for all referenced classes additional classes in /Model beginning with AllOf[Classname]. Why does Swagger CodeGen generate these classes? What is their porpuse?…
4
votes
0 answers

Swagger Documentation when the java class is deserialised from String input

In my request body, I have a field which takes a string as input but is converted into a java object while deserializing. public class UserCredentials { @NotBlank String username; @NotNull ReferenceString passwordRef; } the passwordRef value is…
Deepak Patankar
  • 3,076
  • 3
  • 16
  • 35
4
votes
1 answer

What is the difference between Swagger UI vs Swagger CodeGen?

What is the difference between Swagger UI vs Swagger CodeGen? I read the description in https://swagger.io/tools/. It sounds like Swagger Editor, UI, and codeGen are totally different tools. If I want to generate .Net server stubs and visualize…
Cloe
  • 61
  • 1
  • 2
4
votes
1 answer

How do I prevent the swagger codegen system from creating javadocs?

We're using swagger code generation to create a client side API and the code base was written with java 8 and we're upgrading now to java 11. We're using the 2.4.15 version of swagger-codegen-cli. The code generation works, but at the end it tries…
Tony Giaccone
  • 511
  • 5
  • 18
4
votes
4 answers

How to generate JSON example values for class, just like Swagger does for example response?

I'm using Swagger with my ASP.NET Core application and for a HTTP POST endpoint returning Blog model: [HttpPost] [ProducesResponseType(typeof(Blog), StatusCodes.Status200OK)] public IActionResult AddBlog([FromBody] string name) { // Code removed…
Prolog
  • 2,698
  • 1
  • 18
  • 31
4
votes
1 answer

Angular Typescript: Swagger CodeGen Generator making all class properties Nullable

We are auto generating proxies with SwaggerCodeGen https://swagger.io/ . This will reduce manually typing in hundreds of classes. We noticed all model class properties are Nullable ? in SwaggerCodeGen. When they wrote this, doesn't it break the…
user13885958
4
votes
0 answers

How to generate a JAX-RS (RESTEasy) server for Java 7 using Swagger Codegen?

I have an OpenAPI YAML file loaded in https://editor.swagger.io and from there, I have generated the server code for jaxrs-resteasy. The problem is this code must be integrated in a Java 7 project and Swagger Editor generates the code for Java 8. Is…
FMCR
  • 87
  • 6
4
votes
1 answer

Swagger expand on possible endpoints

I am currently use Swagger to expose all my endpoints, but these endpoints are currently formatted as: /get/{name}, /put/{name}, where the name can only be those names which I have in database? Is somehow possible to make swagger expand the general…
kafka
  • 573
  • 1
  • 11
  • 28
4
votes
0 answers

Why Swagger @ApiModelProperty shows up on getters instead of the attributes in the model classes?

When using swagger code generator (swagger-codegen-cli) from yaml file, I followed instructions in https://swagger.io/docs/open-source-tools/swagger-codegen/ and generated Java code using java -jar swagger-codegen-cli-2.2.1.jar generate -i
Amar
  • 1,556
  • 3
  • 18
  • 28
4
votes
0 answers

Is there any way to override the getter value in swagger codegen?

I have my .yaml file as follows: (Just a partial definition) schemas: BaseResponse: type: object required: - success properties: success: type: boolean default: "false" When I run java…
4
votes
1 answer

swagger-codegen using JSON parser when YML is provided

Trying to generate API classes for PHP using swagger-codegen. [According to the docs][1], it should automatically know the difference between JSON and YML. It does not look like to be the case tho: docker run --rm -v ${PWD}:/local…
Daniel W.
  • 31,164
  • 13
  • 93
  • 151
4
votes
2 answers

swagger-codegen-maven-plugin with springdoc-openapi-ui

I want to use springdoc-openapi-ui in a generated service with swagger-codegen-maven-plugin, but the API generated uses wrong package, it uses io.swagger.annotations instead of io.swagger.v3.oas.annotations What can I do for that? import…
4
votes
1 answer

Compile TypeScript with react-native-typescript-transformer?

Since Expo SDK 31 there is TypeScript support integrated. That’s great. However, as far as I can tell, it uses babel-typescript. For my project, running on Expo SDK 33, I need to use react-native-typescript-transformer instead. Is this possible? How…
Kaloyan Kosev
  • 12,483
  • 8
  • 59
  • 90
4
votes
1 answer

Swagger Codegen 3 and Spring HATEOAS

I'm taking my first swing at creating a RESTful API with OAS 3.0, Swagger Codegen, Spring MVC, and Spring HATEOAS. I want to use the OAS definition for documentation generation and server/client stub generation and use HATEOAS to create hyperlinks…