From 9ac9bc0dc3ee456617d718e2ad66cde7c0e0e2fa Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 10 May 2018 13:08:12 +0800 Subject: [PATCH] enhance ts import (#409) --- .../AbstractTypeScriptClientCodegen.java | 26 ++++++------------ .../TypeScriptAngularClientCodegen.java | 27 ++++--------------- .../TypeScriptAngularJsClientCodegen.java | 18 +++---------- .../TypeScriptAureliaClientCodegen.java | 9 ------- .../TypeScriptFetchClientCodegen.java | 17 +++++------- .../TypeScriptInversifyClientCodegen.java | 20 +++++--------- .../TypeScriptJqueryClientCodegen.java | 16 +++++------ .../TypeScriptNodeClientCodegen.java | 9 +++---- 8 files changed, 39 insertions(+), 103 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java index 7e6b34f8e2b0..9121d755dba3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -17,26 +17,16 @@ package org.openapitools.codegen.languages; -import java.io.File; -import java.util.*; - -import org.openapitools.codegen.CliOption; -import org.openapitools.codegen.CodegenConfig; -import org.openapitools.codegen.CodegenConstants; -import org.openapitools.codegen.CodegenModel; -import org.openapitools.codegen.CodegenProperty; -import org.openapitools.codegen.CodegenType; -import org.openapitools.codegen.DefaultCodegen; +import io.swagger.v3.oas.models.media.ArraySchema; +import io.swagger.v3.oas.models.media.NumberSchema; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.parameters.Parameter; +import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.*; import org.openapitools.codegen.utils.ModelUtils; -import io.swagger.v3.oas.models.media.*; -import io.swagger.v3.oas.models.PathItem; -import io.swagger.v3.oas.models.PathItem.HttpMethod; -import io.swagger.v3.oas.models.*; -import io.swagger.v3.oas.models.parameters.*; -import io.swagger.v3.oas.models.info.*; -import io.swagger.v3.parser.util.SchemaTypeUtil; -import org.apache.commons.lang3.StringUtils; +import java.io.File; +import java.util.*; public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig { private static final String X_DISCRIMINATOR_TYPE = "x-discriminator-value"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java index a27f9fab7f27..fab3a567742d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java @@ -17,32 +17,15 @@ package org.openapitools.codegen.languages; -import java.io.File; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - +import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.parser.util.SchemaTypeUtil; -import org.apache.commons.lang3.StringUtils; -import org.openapitools.codegen.CliOption; -import org.openapitools.codegen.CodegenModel; -import org.openapitools.codegen.CodegenParameter; -import org.openapitools.codegen.CodegenOperation; -import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.*; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.SemVer; -import io.swagger.v3.oas.models.media.*; -import io.swagger.v3.oas.models.PathItem; -import io.swagger.v3.oas.models.PathItem.HttpMethod; -import io.swagger.v3.oas.models.*; -import io.swagger.v3.oas.models.parameters.*; -import io.swagger.v3.oas.models.info.*; +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.*; public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCodegen { private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularJsClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularJsClientCodegen.java index 6eaa11e4fcba..c51c1d89b176 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularJsClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularJsClientCodegen.java @@ -17,23 +17,11 @@ package org.openapitools.codegen.languages; -import java.io.File; - -import io.swagger.v3.parser.util.SchemaTypeUtil; -import org.apache.commons.lang3.StringUtils; -import org.openapitools.codegen.CliOption; -import org.openapitools.codegen.CodegenModel; +import io.swagger.v3.oas.models.media.Schema; import org.openapitools.codegen.CodegenParameter; -import org.openapitools.codegen.CodegenOperation; import org.openapitools.codegen.SupportingFile; -import org.openapitools.codegen.utils.SemVer; - -import io.swagger.v3.oas.models.media.*; -import io.swagger.v3.oas.models.PathItem; -import io.swagger.v3.oas.models.PathItem.HttpMethod; -import io.swagger.v3.oas.models.*; -import io.swagger.v3.oas.models.parameters.*; -import io.swagger.v3.oas.models.info.*; + +import java.io.File; public class TypeScriptAngularJsClientCodegen extends AbstractTypeScriptClientCodegen { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAureliaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAureliaClientCodegen.java index 4eca7dbd5c58..8256154a8398 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAureliaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAureliaClientCodegen.java @@ -17,17 +17,8 @@ package org.openapitools.codegen.languages; -import io.swagger.v3.parser.util.SchemaTypeUtil; -import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; -import io.swagger.v3.oas.models.media.*; -import io.swagger.v3.oas.models.PathItem; -import io.swagger.v3.oas.models.PathItem.HttpMethod; -import io.swagger.v3.oas.models.*; -import io.swagger.v3.oas.models.parameters.*; -import io.swagger.v3.oas.models.info.*; - import java.util.HashSet; import java.util.List; import java.util.Map; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index 6159a8df54b2..bb1161d21e0e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -17,21 +17,16 @@ package org.openapitools.codegen.languages; +import io.swagger.v3.oas.models.media.ArraySchema; +import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.parser.util.SchemaTypeUtil; -import org.apache.commons.lang3.StringUtils; -import org.openapitools.codegen.*; +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.utils.ModelUtils; -import io.swagger.v3.oas.models.media.*; -import io.swagger.v3.oas.models.PathItem; -import io.swagger.v3.oas.models.PathItem.HttpMethod; -import io.swagger.v3.oas.models.*; -import io.swagger.v3.oas.models.parameters.*; -import io.swagger.v3.oas.models.info.*; - -import java.io.File; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.Date; public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodegen { private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java index c96ae855c12e..4b89eddfe063 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java @@ -17,21 +17,15 @@ package org.openapitools.codegen.languages; -import java.io.File; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - +import io.swagger.v3.oas.models.media.BinarySchema; +import io.swagger.v3.oas.models.media.FileSchema; +import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.parser.util.SchemaTypeUtil; -import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; -import io.swagger.v3.oas.models.*; -import io.swagger.v3.oas.models.media.*; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.*; public class TypeScriptInversifyClientCodegen extends AbstractTypeScriptClientCodegen { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptJqueryClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptJqueryClientCodegen.java index 9d3e5b2e4e57..247bee5b63e6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptJqueryClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptJqueryClientCodegen.java @@ -17,19 +17,15 @@ package org.openapitools.codegen.languages; +import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.parser.util.SchemaTypeUtil; -import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.CodegenParameter; +import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.openapitools.codegen.*; -import org.openapitools.codegen.utils.ModelUtils; - -import io.swagger.v3.oas.models.media.*; -import io.swagger.v3.oas.models.PathItem; -import io.swagger.v3.oas.models.PathItem.HttpMethod; -import io.swagger.v3.oas.models.*; -import io.swagger.v3.oas.models.parameters.*; -import io.swagger.v3.oas.models.info.*; import java.io.File; import java.text.SimpleDateFormat; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java index 43622132b27a..4c97e1c04c8f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java @@ -17,7 +17,11 @@ package org.openapitools.codegen.languages; +import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.parser.util.SchemaTypeUtil; +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,11 +29,6 @@ import java.text.SimpleDateFormat; import java.util.Date; -import org.openapitools.codegen.*; -import org.openapitools.codegen.utils.ModelUtils; - -import io.swagger.v3.oas.models.media.*; - public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptNodeClientCodegen.class); private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm");