0

Swagger Codegen generates lots of C# code, but one thing I'd like changed is the fact that it includes the Interface in the same file as the implementation.

namespace {{apiPackage}}
{
    {{#operations}}
    public interface I{{classname}}
    {
        {{#operation}}
        {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}double{{/returnType}} {{nickname}} ({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
        {{/operation}}
    }

    public class {{classname}} : I{{classname}}
    { 
        public {{classname}}(ApiClient apiClient = null)
        {
            // code omitted...

Is there anyway to separate out the interface into a separate file? This isn't modifying the current template, but more specifically adding a new one. The above code snippet comes from api.mustache and in this scenario, I'd like to add another template for Swagger Codegen to use, titled something along the lines of api_interface.mustache

Danny Goodall
  • 798
  • 1
  • 9
  • 33
  • Related: [Is it possible to configure the source code file header generated by Swagger Codegen?](https://stackoverflow.com/q/50165530/113116) – Helen Jun 25 '19 at 08:34
  • @Helen Thanks for the comment, but that question seems to relate to modifying existing templates, whereas I'm asking if there's a way to basically create more templates. I'll update the question with some more detail to explain the problem a bit better. – Danny Goodall Jun 25 '19 at 08:50

0 Answers0