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

Swagger JaxRS-Spec generation fails on simple types unless using editor.swagger.io

I'm having an issue with Swagger YAML and codegeneration. I am trying to generate code from this very simple snippet: swagger: '2.0' info: version: 1.0.0 title: Number API host: localhost basePath: /v2 schemes: - http paths: '/numbers': …
Dentych
  • 106
  • 9
0
votes
0 answers

Swagger codegen - swift 3 ignore params

There is a problem with header params in Swagger Codegen. my RAML file looks like that : ---...--- parameters: timeParam_begin: in: header name: timeframe_begin type: string timeParam_end: name: timeframe_end in: header …
xeonarno
  • 15
  • 7
0
votes
0 answers

Defining final variables in swagger.yaml

Is it somehow possible to define in swagger something that I get this in the Java code with the swagger-codegen project? public final int XYZ = 2; public final String ABC = "something_but_not_abc"; So in my case I want to change the Enums to have…
Joergi
  • 1,527
  • 3
  • 39
  • 82
0
votes
2 answers

useDefaultResponseMessages(false) not working

I'm using the swagger-codegen to create a spring-server. I also used the .useDefaultResponseMessages(false)-attribute as described in Swagger - Springfox always generates some response messages (401,403...) by default. How can I remove…
Volker
  • 1
  • 1
  • 5
0
votes
1 answer

Creating a client stub using swagger-codegen

I have been trying to create a client stub for my front-end client using swagger-codegen. Following is the command that I've been using: java -jar swagger-codegen-cli-2.2.2.jar generate -i "docs-endpoint" -l nodejs-server -o retrofit/ -c…
rcde0
  • 4,192
  • 3
  • 21
  • 31
0
votes
1 answer

swagger codegen jaxrs validation

Is there a way to get swagger codegen to add jaxrs validation annotations for the validation of path parameters and output model. I mean the @Valid and @NotNull annotations in the following code: @Path("/person/{personId}") @GET @Valid public…
medalik
  • 139
  • 1
  • 10
0
votes
1 answer

Tell mustache to ignore specific property name

I have this yaml file: swagger: '2.0' definitions: Customer: type: object properties: toIgnore: type: string name: type: string And this mustache template which create java file with…
shira stenmetz
  • 297
  • 1
  • 6
  • 11
0
votes
1 answer

Generate endpoints in separate classes with swager-codegen

I have below YAML for swagger-codegen and I want it to generate this endpoints in two separate classes, by default it generates one api class with both endpoints, is it s way to mark them as separate api? /tenants: post: produces: -…
Aliaksei Stadnik
  • 1,692
  • 3
  • 15
  • 32
0
votes
1 answer

swagger-codegen not generating classes for schemas defined in referenced json files

I am unable to get swagger-codegen to generate classes for json schemas defined in files separate from the main API definition file. The command I am using is: $ java -jar swagger-codegen-cli-2.2.2.jar generate -i api.json -l java -o gen -v This is…
subodh
  • 337
  • 2
  • 6
  • 18
0
votes
0 answers

Swagger client generated for Scala: " Missing implicit ClientResponseReader"

I am testing the Swagger Codegen capabilities using the Pet Store demo application (http://petstore.swagger.io/) so I got myself a client generated for Scala. While trying to test in a test class I got this compilation error: [error]…
Victor
  • 2,450
  • 2
  • 23
  • 54
0
votes
2 answers

swagger api key in header

I am using swagger codegen to create C# code to use as a client api call. java -jar swagger-codegen-cli.jar generate -i http://testing.com/swagger/docs/v1 -c config.json -l csharp -o testing-api config.json: { "modelPropertyNaming":…
Alvin
  • 8,219
  • 25
  • 96
  • 177
0
votes
1 answer

Swagger UI example data

Is there a way in swagger to show example data for; model, both input & output, query parameters, headers, etc? I have been unable to find anything related to this in the annotations documentation;…
user2524908
  • 861
  • 4
  • 18
  • 46
0
votes
0 answers

Why does swagger-codegen generate code that returns status 200 when there are validation errors

I used swagger-codegen to build a service api in javascript. When the call works it returns my custom defined type and status 200, but when there is a validation error it returns an error but also a status 200. For example: { "message":…
BeWarned
  • 2,280
  • 1
  • 15
  • 22
0
votes
1 answer

swagger code generation for spring boot page not found

I git cloned the swagger-api/swagger-codegen project from github and tried the generated code in samples/server/petstore/springboot (mvn package and java -jar ...). The server runs but I can't access any of the apis. They always say 404 not found.…
Jack Peng
  • 576
  • 5
  • 19
0
votes
1 answer

cannot connect to the server stub using java client

I recently joined a project.I am a beginner. My responsibility is to create server stub, create SDK and create a java client using SDk and communicate with server stub. I created server stub using, java -jar /data/Swagger/swagger-codegen-cli.jar…
cmb28
  • 421
  • 9
  • 24