forked from loafle/openapi-generator-original
Add command to display all library templates supported
for a specific language
This commit is contained in:
@@ -109,6 +109,8 @@ public interface CodegenConfig {
|
||||
|
||||
void setSkipOverwrite(boolean skipOverwrite);
|
||||
|
||||
Map<String, String> supportedLibraries();
|
||||
|
||||
void setLibrary(String library);
|
||||
|
||||
/**
|
||||
|
||||
@@ -81,6 +81,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 String library = null;
|
||||
|
||||
public List<CliOption> cliOptions() {
|
||||
@@ -1389,7 +1390,16 @@ public class DefaultCodegen {
|
||||
this.skipOverwrite = skipOverwrite;
|
||||
}
|
||||
|
||||
/**
|
||||
* All library templates supported.
|
||||
*/
|
||||
public Map<String, String> supportedLibraries() {
|
||||
return supportedLibraries;
|
||||
}
|
||||
|
||||
public void setLibrary(String library) {
|
||||
if (library != null && !supportedLibraries.containsKey(library))
|
||||
throw new RuntimeException("unknown library: " + library);
|
||||
this.library = library;
|
||||
}
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
|
||||
String templateFile = null;
|
||||
String library = config.getLibrary();
|
||||
if (library != null) {
|
||||
if (library != null && !"".equals(library)) {
|
||||
String libTemplateFile = config.templateDir() + File.separator +
|
||||
"libraries" + File.separator + library + File.separator +
|
||||
support.templateFile;
|
||||
|
||||
@@ -61,6 +61,9 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
cliOptions.add(new CliOption("artifactId", "artifactId in generated pom.xml"));
|
||||
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("jersey2", "HTTP client: Jersey client 2.6");
|
||||
}
|
||||
|
||||
public CodegenType getTag() {
|
||||
|
||||
Reference in New Issue
Block a user