import model only if it has import for c#

This commit is contained in:
wing328 2015-07-02 11:18:41 +08:00
parent 488e604207
commit 422da698f6
5 changed files with 8 additions and 7 deletions

View File

@ -430,6 +430,12 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
}
operations.put("imports", imports);
// add a flag to indicate whether there's any {{import}}
if (imports.size() > 0) {
operations.put("hasImport", true);
}
config.postProcessOperations(operations);
if (objs.size() > 0) {
List<CodegenOperation> os = (List<CodegenOperation>) objs.get("operation");

View File

@ -4,13 +4,11 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using RestSharp;
using {{packageName}}.Client;
using {{packageName}}.Model;
{{#imports}}
{{/imports}}
{{#hasImport}}using {{packageName}}.Model;
{{/hasImport}}
namespace {{packageName}}.Api {
{{#operations}}
public interface I{{classname}} {
{{#operation}}
/// <summary>

View File

@ -8,7 +8,6 @@ using IO.Swagger.Model;
namespace IO.Swagger.Api {
public interface IPetApi {
/// <summary>

View File

@ -8,7 +8,6 @@ using IO.Swagger.Model;
namespace IO.Swagger.Api {
public interface IStoreApi {
/// <summary>

View File

@ -8,7 +8,6 @@ using IO.Swagger.Model;
namespace IO.Swagger.Api {
public interface IUserApi {
/// <summary>