swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.94k stars 6.03k forks source link

Custom Server Stub for Spring Boot using swagger-codegen #6943

Open sri420 opened 6 years ago

sri420 commented 6 years ago
Description

I want to use swagger-codegen from command line to generate code based on the specification created by Swagger ui.

I am looking to customize the generator used for Spring Boot because we feel the project structure and other artifacts should be customized for our project requirements.

But, I do not see any options for customizing an existing generator used for Spring Boot nor on how I can create a new code generator for a language in my case Spring Boot.

I only see the link to the wiki page on how to use a Server stub generator for different languages. I want to know if and how I can create a custom Server Stub for Spring Boot or for that matter any language.

Also, I see another link to create own codegen modules.

Does this step apply to Server Stubs too or is there a different process to create own Server Stubs.

Swagger-codegen version

I am using swagger-codegen-cli-2.2.1.

Can you please let me know if that is possible and if so how I can achieve that.

wing328 commented 6 years ago

I am using swagger-codegen-cli-2.2.1.

Please try the latest version in the current master as 2.2.1 was a bit old. SNAPSSHOT version of the latest master is available in the README.

If the default output does not meet your requirement, please try various CLI options to customize the output and ultimately try to generate code with customized templates using the -t option.