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

How to Authorize once in Swagger UI in case of multiple swagger definitions

I need to Authorize in the Swagger UI once by hitting Authorize Button. Is it possible to switch between different swagger endpoints and have token pre-set on all of them? Now it doesn't understand I already authenticated or loses received token on…
3
votes
1 answer

Swagger Codegen OneOf generating incorrectly

I am generating a JavaClient using an OpenAPISpec document. I have used swagger-codegen 3.0 to generate the code. The OpenAPISpec version is 3.0.1. Below is the OpenAPI snippet I am facing problems with: "RequestWithInsuranceInfo": { "type":…
Ayushi Puri
  • 31
  • 1
  • 2
3
votes
1 answer

How can I get OpenApi-Generator to produce nullable DateTimeOffset?

My API exposes some endpoints with DateTime? and others with DateTimeOffset?. I want to generate an API Client using OpenApi-Generator, that will create client code for each endpoint, respecting the differences between the types. OpenApi-Generator…
DaveDev
  • 41,155
  • 72
  • 223
  • 385
3
votes
0 answers

Is it possible to reference yaml file in jar for swagger-codegen from a declared dependency?

i am packaging my swagger yaml file in it's own project, which gets packaged as a jar uploaded to our maven repository. With the swagger file and the swagger-maven-codegen-plugin it should be possible for the clients to generate their nedded models…
Dos
  • 67
  • 7
3
votes
1 answer

OpenAPI adding underscore to properties that have same names as access modifiers in Angular

In my model definition I have a property called "public" as part of an object. When running the swagger code-gen, it generates the code for my object, but it adds an underscore to the "public" property. So my object looks as follows: export…
p192
  • 518
  • 1
  • 6
  • 19
3
votes
3 answers

Asp.NET Core - Web Api - OpenApi Client method names

I'm generating my Swagger/OpenAPI descriptor in my API: services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "AthCoin API", Version = "v1", …
danilonet
  • 1,757
  • 16
  • 33
3
votes
0 answers

Nullable enum parameter in C# code generated from OpenAPI v3 yml

The title is too stuffed and rather confusing, so here is a snippet of my yml: openapi: 3.0.2 ... paths: /whatever: get: tags: - hi parameters: - name: status in: query schema: $ref:…
user3272018
  • 2,309
  • 5
  • 26
  • 48
3
votes
1 answer

No marketplace entries found to handle swagger-codegen-maven-plugin

Is there a way to resolve/suppress the error "No marketplace entries found to handle swagger-codegen-maven-plugin:3.0.23:generate in Eclipse." when importing projects into Eclipse? swagger-codegen in my pom.xml is shown below,
Jimson James
  • 2,937
  • 6
  • 43
  • 78
3
votes
1 answer

What is the correct way to declare a 'char' in an OpenAPI/Swagger-file?

What is the correct way to declare a 'char' in an OpenAPI/Swagger-file? I tried these.. but didn't work myTestProperty: type: char example: C or B I tired this way as well, but no luck myTestProperty: type: string format: char …
rakesh mehra
  • 618
  • 1
  • 9
  • 21
3
votes
0 answers

Why is Swagger duplicating fields in the UI

I am trying to display POJO data to allow external users to get information about the necessary structure for a REST API using Swagger. However, I have run into an issue where a class that contains fields that are in all caps displays the…
KM529
  • 372
  • 4
  • 17
3
votes
1 answer

Error while compiling swagger-codegen java Petstore sdk

I am trying to generate a java API using swagger-codegen (3.0.0) I am using the swagger-codegen-cli-3.0.24.jar version of codegen jar. I ran the following command to generate the SDK for the sample petstore project: java -jar swagger-codegen-cli.jar…
AmanSinghal
  • 2,404
  • 21
  • 22
3
votes
0 answers

Object generated from swagger-codegen v3 for multipart-form-data is null

I have following swagger yaml file /tasks/{id}/documents/files/data: post: tags: - task-documents summary: Upload document description: Upload document operationId: uploadDocument parameters: - name:…
ashishb
  • 81
  • 2
  • 11
3
votes
1 answer

What happens when we pass extra field in request body(JSON) in a OpenAPI POST endpoint

I was working on Swagger generated OpenAPI specification and I noticed that if we pass some extra fields in PUT/POST API endpoint, then the server doesn't throw any error, even though it process all valid/necessary field. So my doubt is that Should…
Aman Chourasiya
  • 1,078
  • 1
  • 10
  • 23
3
votes
0 answers

How to add Jackson annotations to specific fields on swagger generated model classes for Spring

Folks, With swagger 2.0 does anyone know if it's possible to add Jackson annotations to specific fields on swagger generated model classes when using swagger codegen with 'spring' as the 'language' spring? I want to use Jackson…
lmk
  • 654
  • 5
  • 21
3
votes
2 answers

How to include swagger generated classes in project directory

I am trying to use Swagger Codegen to generate model classes for my spring boot project. I found some references online and included the following plugin in my pom.xml: org.springframework.boot
Gurunath Sripad
  • 1,308
  • 2
  • 14
  • 24