Skip to content

Commit 48c5704

Browse files
committed
#6041 removed annotations and imports from airline library.
1 parent 23f491c commit 48c5704

File tree

6 files changed

+12
-157
lines changed

6 files changed

+12
-157
lines changed

modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/ConfigHelp.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
package io.swagger.codegen.cmd;
22

3-
import io.airlift.airline.Command;
4-
import io.airlift.airline.Option;
53
import io.swagger.codegen.CliOption;
64
import io.swagger.codegen.CodegenConfig;
75
import io.swagger.codegen.CodegenConfigLoader;
86

9-
@Command(name = "config-help", description = "Config help for chosen lang")
107
public class ConfigHelp implements Runnable {
11-
12-
@Option(name = {"-l", "--lang"}, title = "language", required = true,
13-
description = "language to get config help for")
148
private String lang;
159

1610
@Override

modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java

Lines changed: 9 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,175 +1,60 @@
11
package io.swagger.codegen.cmd;
22

3-
import io.airlift.airline.Command;
4-
import io.airlift.airline.Option;
53
import io.swagger.codegen.ClientOptInput;
6-
import io.swagger.codegen.CodegenConstants;
74
import io.swagger.codegen.DefaultGenerator;
85
import io.swagger.codegen.config.CodegenConfigurator;
96
import org.slf4j.Logger;
107
import org.slf4j.LoggerFactory;
118

12-
import static io.swagger.codegen.config.CodegenConfiguratorUtils.*;
13-
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
14-
159
import java.util.ArrayList;
1610
import java.util.List;
1711

12+
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyAdditionalPropertiesKvpList;
13+
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyImportMappingsKvpList;
14+
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyInstantiationTypesKvpList;
15+
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyLanguageSpecificPrimitivesCsvList;
16+
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyReservedWordsMappingsKvpList;
17+
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applySystemPropertiesKvpList;
18+
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyTypeMappingsKvpList;
19+
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
20+
1821
/**
1922
* User: lanwen Date: 24.03.15 Time: 20:22
2023
*/
2124

22-
@Command(name = "generate", description = "Generate code with chosen lang")
2325
public class Generate implements Runnable {
2426

2527
public static final Logger LOG = LoggerFactory.getLogger(Generate.class);
2628

27-
@Option(name = {"-v", "--verbose"}, description = "verbose mode")
2829
private Boolean verbose;
29-
30-
@Option(name = {"-l", "--lang"}, title = "language", required = true,
31-
description = "client language to generate (maybe class name in classpath, required)")
3230
private String lang;
33-
34-
@Option(name = {"-o", "--output"}, title = "output directory",
35-
description = "where to write the generated files (current dir by default)")
3631
private String output = "";
37-
38-
@Option(name = {"-i", "--input-spec"}, title = "spec file", required = true,
39-
description = "location of the swagger spec, as URL or file (required)")
4032
private String spec;
41-
42-
@Option(name = {"-t", "--template-dir"}, title = "template directory",
43-
description = "folder containing the template files")
4433
private String templateDir;
45-
46-
@Option(
47-
name = {"-a", "--auth"},
48-
title = "authorization",
49-
description = "adds authorization headers when fetching the swagger definitions remotely. "
50-
+ "Pass in a URL-encoded string of name:header with a comma separating multiple values")
5134
private String auth;
52-
53-
@Option(
54-
name = {"-D"},
55-
title = "system properties",
56-
description = "sets specified system properties in "
57-
+ "the format of name=value,name=value (or multiple options, each with name=value)")
5835
private List<String> systemProperties = new ArrayList<>();
59-
60-
@Option(
61-
name = {"-c", "--config"},
62-
title = "configuration file",
63-
description = "Path to json configuration file. "
64-
+ "File content should be in a json format {\"optionKey\":\"optionValue\", \"optionKey1\":\"optionValue1\"...} "
65-
+ "Supported options can be different for each language. Run config-help -l {lang} command for language specific config options.")
6636
private String configFile;
67-
68-
@Option(name = {"-s", "--skip-overwrite"}, title = "skip overwrite",
69-
description = "specifies if the existing files should be "
70-
+ "overwritten during the generation.")
7137
private Boolean skipOverwrite;
72-
73-
@Option(name = {"--api-package"}, title = "api package",
74-
description = CodegenConstants.API_PACKAGE_DESC)
7538
private String apiPackage;
76-
77-
@Option(name = {"--model-package"}, title = "model package",
78-
description = CodegenConstants.MODEL_PACKAGE_DESC)
7939
private String modelPackage;
80-
81-
@Option(name = {"--model-name-prefix"}, title = "model name prefix",
82-
description = CodegenConstants.MODEL_NAME_PREFIX_DESC)
8340
private String modelNamePrefix;
84-
85-
@Option(name = {"--model-name-suffix"}, title = "model name suffix",
86-
description = CodegenConstants.MODEL_NAME_SUFFIX_DESC)
8741
private String modelNameSuffix;
88-
89-
@Option(
90-
name = {"--instantiation-types"},
91-
title = "instantiation types",
92-
description = "sets instantiation type mappings in the format of type=instantiatedType,type=instantiatedType."
93-
+ "For example (in Java): array=ArrayList,map=HashMap. In other words array types will get instantiated as ArrayList in generated code."
94-
+ " You can also have multiple occurrences of this option.")
9542
private List<String> instantiationTypes = new ArrayList<>();
96-
97-
@Option(
98-
name = {"--type-mappings"},
99-
title = "type mappings",
100-
description = "sets mappings between swagger spec types and generated code types "
101-
+ "in the format of swaggerType=generatedType,swaggerType=generatedType. For example: array=List,map=Map,string=String."
102-
+ " You can also have multiple occurrences of this option.")
10343
private List<String> typeMappings = new ArrayList<>();
104-
105-
@Option(
106-
name = {"--additional-properties"},
107-
title = "additional properties",
108-
description = "sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value."
109-
+ " You can also have multiple occurrences of this option.")
11044
private List<String> additionalProperties = new ArrayList<>();
111-
112-
@Option(
113-
name = {"--language-specific-primitives"},
114-
title = "language specific primitives",
115-
description = "specifies additional language specific primitive types in the format of type1,type2,type3,type3. For example: String,boolean,Boolean,Double."
116-
+ " You can also have multiple occurrences of this option.")
11745
private List<String> languageSpecificPrimitives = new ArrayList<>();
118-
119-
@Option(
120-
name = {"--import-mappings"},
121-
title = "import mappings",
122-
description = "specifies mappings between a given class and the import that should be used for that class in the format of type=import,type=import."
123-
+ " You can also have multiple occurrences of this option.")
12446
private List<String> importMappings = new ArrayList<>();
125-
126-
@Option(name = {"--invoker-package"}, title = "invoker package",
127-
description = CodegenConstants.INVOKER_PACKAGE_DESC)
12847
private String invokerPackage;
129-
130-
@Option(name = {"--group-id"}, title = "group id", description = CodegenConstants.GROUP_ID_DESC)
13148
private String groupId;
132-
133-
@Option(name = {"--artifact-id"}, title = "artifact id",
134-
description = CodegenConstants.ARTIFACT_ID_DESC)
13549
private String artifactId;
136-
137-
@Option(name = {"--artifact-version"}, title = "artifact version",
138-
description = CodegenConstants.ARTIFACT_VERSION_DESC)
13950
private String artifactVersion;
140-
141-
@Option(name = {"--library"}, title = "library", description = CodegenConstants.LIBRARY_DESC)
14251
private String library;
143-
144-
@Option(name = {"--git-user-id"}, title = "git user id",
145-
description = CodegenConstants.GIT_USER_ID_DESC)
14652
private String gitUserId;
147-
148-
@Option(name = {"--git-repo-id"}, title = "git repo id",
149-
description = CodegenConstants.GIT_REPO_ID_DESC)
15053
private String gitRepoId;
151-
152-
@Option(name = {"--release-note"}, title = "release note",
153-
description = CodegenConstants.RELEASE_NOTE_DESC)
15454
private String releaseNote;
155-
156-
@Option(name = {"--http-user-agent"}, title = "http user agent",
157-
description = CodegenConstants.HTTP_USER_AGENT_DESC)
15855
private String httpUserAgent;
159-
160-
@Option(
161-
name = {"--reserved-words-mappings"},
162-
title = "reserved word mappings",
163-
description = "specifies how a reserved name should be escaped to. Otherwise, the default _<name> is used. For example id=identifier."
164-
+ " You can also have multiple occurrences of this option.")
16556
private List<String> reservedWordsMappings = new ArrayList<>();
166-
167-
@Option(name = {"--ignore-file-override"}, title = "ignore file override location",
168-
description = CodegenConstants.IGNORE_FILE_OVERRIDE_DESC)
16957
private String ignoreFileOverride;
170-
171-
@Option(name = {"--remove-operation-id-prefix"}, title = "remove prefix of the operationId",
172-
description = CodegenConstants.REMOVE_OPERATION_ID_PREFIX_DESC)
17358
private Boolean removeOperationIdPrefix;
17459

17560
@Override

modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Langs.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package io.swagger.codegen.cmd;
22

33
import ch.lambdaj.collection.LambdaIterable;
4-
import io.airlift.airline.Command;
54
import io.swagger.codegen.CodegenConfig;
65

76
import static ch.lambdaj.Lambda.on;
@@ -11,7 +10,6 @@
1110
/**
1211
* User: lanwen Date: 24.03.15 Time: 20:25
1312
*/
14-
@Command(name = "langs", description = "Shows available langs")
1513
public class Langs implements Runnable {
1614
@Override
1715
public void run() {

modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Meta.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import com.google.common.collect.ImmutableList;
66
import com.google.common.collect.ImmutableMap;
77
import com.samskivert.mustache.Mustache;
8-
import io.airlift.airline.Command;
9-
import io.airlift.airline.Option;
108
import io.swagger.codegen.DefaultGenerator;
119
import io.swagger.codegen.SupportingFile;
1210
import org.apache.commons.io.FileUtils;
@@ -25,27 +23,15 @@
2523
/**
2624
* User: lanwen Date: 24.03.15 Time: 20:22
2725
*/
28-
29-
@Command(name = "meta", description = "MetaGenerator. Generator for creating a new template set "
30-
+ "and configuration for Codegen. The output will be based on the language you "
31-
+ "specify, and includes default templates to include.")
3226
public class Meta implements Runnable {
3327

3428
private static final Logger LOGGER = LoggerFactory.getLogger(Meta.class);
3529

3630
private static final String TEMPLATE_DIR_CLASSPATH = "codegen";
3731
private static final String MUSTACHE_EXTENSION = ".mustache";
3832

39-
@Option(name = {"-o", "--output"}, title = "output directory",
40-
description = "where to write the generated files (current dir by default)")
4133
private String outputFolder = "";
42-
43-
@Option(name = {"-n", "--name"}, title = "name",
44-
description = "the human-readable name of the generator")
4534
private String name = "default";
46-
47-
@Option(name = {"-p", "--package"}, title = "package",
48-
description = "the package to put the main class into (defaults to io.swagger.codegen)")
4935
private String targetPackage = "io.swagger.codegen";
5036

5137
@Override

modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Validate.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
package io.swagger.codegen.cmd;
22

3-
import io.airlift.airline.Command;
4-
import io.airlift.airline.Option;
5-
63
import io.swagger.parser.SwaggerParser;
74
import io.swagger.parser.util.SwaggerDeserializationResult;
85

96
import java.util.HashSet;
107
import java.util.List;
118
import java.util.Set;
129

13-
@Command(name = "validate", description = "Validate specification")
1410
public class Validate implements Runnable {
1511

16-
@Option(name = {"-i", "--input-spec"}, title = "spec file", required = true,
17-
description = "location of the swagger spec, as URL or file (required)")
1812
private String spec;
1913

2014
@Override

modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Version.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package io.swagger.codegen.cmd;
22

3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
36
import java.io.IOException;
47
import java.io.InputStream;
58
import java.util.Properties;
69

7-
import io.airlift.airline.Command;
8-
import org.slf4j.Logger;
9-
import org.slf4j.LoggerFactory;
10-
11-
@Command(name = "version", description = "Show version information")
1210
public class Version implements Runnable {
1311

1412
private static final Logger LOGGER = LoggerFactory.getLogger(Meta.class);

0 commit comments

Comments
 (0)