Yes it's possible. The output format is defined using Mustache templates.
Find the templates for your language here:
Download the templates you want to change and modify them as required. Then run the generator using the -t
argument to specify the path to your custom templates:
java -jar swagger-codegen-cli-2-4-18.jar generate
-i http://petstore.swagger.io/v2/swagger.json
-l csharp
-o PetstoreCSharpClient
-t path/to/MyTemplates <------
Any custom templates found in the -t
folder will be used instead of the corresponding standard templates. Templates not found in the -t
folder will default to the standard templates.
Example
In case of the csharp
generator in Codegen 2.x (OAS2), the header in question comes from:
modules/swagger-codegen/src/main/resources/csharp/partial_header.mustache
and there are similar headers in:
modules/swagger-codegen/src/main/resources/csharp/Project.mustache
modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache
Download these 3 files to, say, C:\MyTemplates
, and remove unwanted lines from them. Then run the generator with -t C:\MyTemplates
to use your custom templates without that header.