forked from loafle/openapi-generator-original
Change the "--library" option into a config option
This commit is contained in:
@@ -55,6 +55,7 @@ import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -81,7 +82,7 @@ public class DefaultCodegen {
|
||||
protected List<CliOption> cliOptions = new ArrayList<CliOption>();
|
||||
protected boolean skipOverwrite;
|
||||
protected boolean supportsInheritance = false;
|
||||
protected Map<String, String> supportedLibraries = new HashMap<String, String>();
|
||||
protected Map<String, String> supportedLibraries = new LinkedHashMap<String, String>();
|
||||
protected String library = null;
|
||||
|
||||
public List<CliOption> cliOptions() {
|
||||
@@ -1392,6 +1393,7 @@ public class DefaultCodegen {
|
||||
|
||||
/**
|
||||
* All library templates supported.
|
||||
* (key: library name, value: library description)
|
||||
*/
|
||||
public Map<String, String> supportedLibraries() {
|
||||
return supportedLibraries;
|
||||
@@ -1409,4 +1411,12 @@ public class DefaultCodegen {
|
||||
public String getLibrary() {
|
||||
return library;
|
||||
}
|
||||
|
||||
protected CliOption buildLibraryCliOption(Map<String, String> supportedLibraries) {
|
||||
StringBuilder sb = new StringBuilder("library template (sub-template) to use:");
|
||||
for (String lib : supportedLibraries.keySet()) {
|
||||
sb.append("\n").append(lib).append(" - ").append(supportedLibraries.get(lib));
|
||||
}
|
||||
return new CliOption("library", sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,8 +62,9 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
cliOptions.add(new CliOption("artifactVersion", "artifact version in generated pom.xml"));
|
||||
cliOptions.add(new CliOption("sourceFolder", "source folder for generated code"));
|
||||
|
||||
supportedLibraries.put("", "HTTP client: Jersey client 1.18. JSON processing: Jackson 2.4.2");
|
||||
supportedLibraries.put("<default>", "HTTP client: Jersey client 1.18. JSON processing: Jackson 2.4.2");
|
||||
supportedLibraries.put("jersey2", "HTTP client: Jersey client 2.6");
|
||||
cliOptions.add(buildLibraryCliOption(supportedLibraries));
|
||||
}
|
||||
|
||||
public CodegenType getTag() {
|
||||
|
||||
Reference in New Issue
Block a user