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
55
votes
6 answers

How can I set a description and an example in Swagger with Swagger annotations?

I am creating a REST Api using Spring boot, and auto generating the swagger documentation in controllers using swagger codegen. However, I am not able to set a description and example for a parameter of type String in a POST request. Here is mi…
Roman
  • 1,691
  • 4
  • 18
  • 35
51
votes
10 answers

Can you completely disable CORS support in Spring?

As described in CORS preflight request fails due to a standard header if you send requests to OPTIONS endpoints with the Origin and Access-Control-Request-Method headers set then they get intercepted by the Spring framework, and your method does not…
baynezy
  • 6,493
  • 10
  • 48
  • 73
46
votes
3 answers

openapi tools generator vs swagger codegen

I am lost in dependencies and tools: I previously use the following tool to generate code for my swagger…
bvdb
  • 22,839
  • 10
  • 110
  • 123
40
votes
2 answers

Generate .NET Client from Swagger

What tool can I use to generate a .NET Client to consume from a Swagger definition? For example, I started trying NSwag Studio and I would like to be able to generate the code to look like the Repository classes I am used to create. Note to the…
Antoine Griffard
  • 1,019
  • 1
  • 9
  • 21
32
votes
1 answer

How to fix java.lang.RuntimeException: missing swagger input or config?

I'm trying to generate java code from swagger.json using swagger-codegen-cli.jar but I get this exception: Exception in thread "main" java.lang.RuntimeException: missing swagger input or config! at…
Amine
  • 901
  • 2
  • 14
  • 33
27
votes
2 answers

Swagger Codegen (with maven plugin) for OpenAPI 3.0

I want to use Swagger Codegen for OpenAPI 3.0 YAML file. And I see Swagger Codegen 3.0.0-rc0 is available. But when I try to use that I run into issues. Following are the details: My pom.xml file with swagger-codegen plugin:
Kuldeep Jain
  • 8,409
  • 8
  • 48
  • 73
26
votes
4 answers

what does Swagger server stub mean?

What does the term Server Stub mean in the context of the Swagger ecosystem? How is it used?
Mo Haidar
  • 3,748
  • 6
  • 37
  • 76
26
votes
2 answers

How to document dynamic query parameter names in OpenAPI (Swagger)?

Is there any way to document the following query? GET api/v1/users?name1=value1&name2=value where the query parameter names are dynamic and will be received from the client. I'm using the latest Swagger API.
Sharad Ahire
  • 758
  • 2
  • 16
  • 32
26
votes
2 answers

How to generate swagger.json using gradle?

I want to use swagger-codegen to generate REST clients and possibly static HTML documentation. However, swagger-codegen needs swagger.json for input. I am aware, that I can get this from a running REST server equipped with Swagger. But is there a…
tbsalling
  • 4,477
  • 4
  • 30
  • 51
24
votes
5 answers

cleanest way to glue generated Flask app code (Swagger-Codegen) to backend implementation

I have: a library that does [Stuff] a swagger API definition, which is roughly #1 with minor differences to map cleanly to a REST service a flask app generated #2 using Swagger-Codegen - eg results in python controller functions roughly one-to-one…
some bits flipped
  • 2,592
  • 4
  • 27
  • 42
22
votes
3 answers

Swagger Codegen CLI Java Client - How to use it right

I'm currently playing around with my jersey2 rest service. For a better overview of the given service (description, types and so on) I make heavily use of swagger (swagger-jersey2-jaxrs). So I'm able to genereate my service description…
Matthias
  • 400
  • 1
  • 4
  • 13
20
votes
6 answers

How to develop a simple REST Client using Swagger codegen?

I'm learning about Swagger and how to generate REST Client using Swagger codegen. I know how to do documentation with Swagger, also I know how to generate a simple REST Server with Swagger, but I don't know how to generate a simple REST Client with…
elvis
  • 956
  • 9
  • 33
  • 56
19
votes
2 answers

How to run swagger-codegen for OpenAPI 3.0.0

looks like official swagger for openapi specification V3 support is near release https://blog.readme.io/an-example-filled-guide-to-swagger-3-2/, and the swagger-codegen has 3.0.0 support developed and passing some level of testing…
some bits flipped
  • 2,592
  • 4
  • 27
  • 42
18
votes
4 answers

Customize generated model names - Swagger UI

I'm trying to adjust the "displayName" of the model being used in an automatically generated Swagger definition. This will only affect the Swagger names, meaning the namespace in code would be left untouched, whilst when looking at the model from…
Hexie
  • 3,955
  • 6
  • 32
  • 55
16
votes
2 answers

Significance of Delegate Design Pattern in Swagger Generated Code?

When i generate code for Spring from my swagger yaml , usually controller layer is generated using delegate pattern , such that for a single model three files are generated . For example , if i defined a model named Person in my swagger/open API…
Saurabh Chaturvedi
  • 2,028
  • 2
  • 18
  • 39
1
2 3
65 66