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

how to ignore api or property in swagger codegen

We need the possibility to add some annotation/extension, on API level and on parameter level, which marks the swagger to ignore it and not generate it (not to generate in the java outputs). Any ideas how can it done? paths: /productOffering: …
Galit Raiter
  • 31
  • 1
  • 3
3
votes
0 answers

Swagger generated Java Client has no overloaded calls, even though the query parameter is marked as optional

I'm introducing an optional "query parameter" (with default value) for one of my API endpoint ( i.e. /foo2) but hoping that existing API consumers don't have to make any changes in their application when they regenerate the java client stub from…
3
votes
1 answer

Swagger 2 annotations - meaningful schema example for maps

This is pretty much the same as this other question for Swagger 1, except it's related to Swagger 2. In short, I have an implementation i'm trying to annotate in order to generate an OpenApi 3 spec. One of the models has a map property, and I want…
Morfic
  • 15,178
  • 3
  • 51
  • 61
3
votes
0 answers

Workflow with Laravel & Swagger / OpenAPI

I'm currently working on an API which is based on OpenAPI 3.0 / Swagger. I find the API docs & code generation extremely useful, but what happens when a simple thing in the API changes? I would generate a new Server (based on Lumen / Laravel) and…
Stefan
  • 2,028
  • 2
  • 36
  • 53
3
votes
2 answers

springfox swagger configuration for JsonNode property in a model class

I have a Model 'NewModel' with the following property import com.fasterxml.jackson.databind.JsonNode; @ApiModel( description = "Data Class to hold new details" ) public class NewModel { @ApiModelProperty( notes = "Value in JSON…
abisheksampath
  • 376
  • 8
  • 23
3
votes
1 answer

How to change JavaScript module name generated by Swagger Codegen?

I'm using Swagger Codegen to generate a JavaScript client: swagger-codegen generate -i http://localhost:8080/v2/api-docs \ -l javascript -o subscreasy-javascript-client The name of the generated module is api-documentation. How can I configure…
Halil
  • 1,795
  • 1
  • 24
  • 39
3
votes
0 answers

Can swagger use predefined java enums during code gen

I am using Swagger to generate the client code my APIs. One of the endpoint's input uses a enum. So I had to define the enum as part of YAML definition file, after which Swagger generates the enum java file. But I already have a java enum in the…
Ram
  • 31
  • 3
3
votes
0 answers

How can I exclude certain operations/HTTP Verbs with Swagger Codegen?

I'm using Swagger w/ AWS API Gateway. In order to fully support CORS, I have several OPTIONS methods in my swagger file; they exist only to tell API Gateway to return CORS headers so that preflight requests from my Angular app succeed. However, when…
user1543276
  • 436
  • 5
  • 11
3
votes
1 answer

Is it possible to configure the source code file header generated by swagger-codegen?

I am using swagger-codegen to generate a SDK based on my Web API, and the generated source files contains the following header: /* * [MY PROJECT NAME] * * [MY COPYRIGHT] * * OpenAPI spec version: 1.0.0 - Beta * Contact: [MY EMAIL] *…
Toto
  • 736
  • 9
  • 33
3
votes
1 answer

Netflix Feign Code Generation using Swagger

I found the project https://github.com/swagger-api/swagger-codegen . However this is generating a client that is based on OpenFeign. Is there a way to generate a client interface automatically that uses Netflix's feign annotation with request…
Menelaos
  • 23,508
  • 18
  • 90
  • 155
3
votes
0 answers

Swagger-Codegen: How to stuff JSON blob in a String

I'm using a swagger yaml file to define my API and generate Java code out of it. With this structure: SomeStructure: type: object properties: field1: type: string required: true field2: type: string …
JS Bournival
  • 113
  • 2
  • 7
3
votes
1 answer

C# SwaggerGen + AutoRest - How to send a Stream body?

I imagine this is a pretty typical scenario: Our solution exposes an API constructed from asp core C# controllers, from which we generate a swagger.json (Using https://github.com/domaindrivendev/Swashbuckle.AspNetCore). We call this api in code…
Stephen O
  • 91
  • 8
3
votes
4 answers

Eclipse project does not recognize Swagger Codegen artefacts

I added Swagger Codegen to my Eclipse project by modifying my pom.xml file directly: