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.98k stars 6.03k forks source link

How to reuse existing language support? #7002

Open przemyslawlib-blueveery opened 6 years ago

przemyslawlib-blueveery commented 6 years ago
Description

I want to add a bunch of "support" files to existing language. What should I do to copy existing generator+template combo to be able to customize it. (I would like to work on a copy so that future swagger-codegen changes do not break them. I think I need to modify generator as well to add lines declaring new "support" files.)

I've tried to follow this to create custom code gen: https://github.com/swagger-api/swagger-codegen#making-your-own-codegen-modules

However I'm unable to copy existing codegen&templates (from modules/swagger-codegen/src/main/resources/*), to folder of newly created codegen module, compile it and then make it visible to swagger-codegen.

PS. swagger-codegen help meta do claim that generator will be generated accordingly to specified language, but it show no option/parameter to specify it.

Swagger-codegen version

2.2.3

Suggest a fix/enhancement

Add documentation showing how to create custom codegen module starting from existing generator&template combo.

wing328 commented 6 years ago

@przemyslawlib-blueveery can you please try https://github.com/swagger-api/swagger-codegen/pull/6487 to see if it would meet your requirement?

git checkout -b ToreJohansson-master master
git pull https://github.com/ToreJohansson/swagger-codegen.git master
przemyslawlib-blueveery commented 6 years ago

OK. What I did in the end.

Should I make PR with adding above to readme? (expanded to paragraphs and actual commands)

wing328 commented 6 years ago

What about adding to FAQ -> General?

https://github.com/swagger-api/swagger-codegen/wiki/FAQ