Merge remote-tracking branch 'origin/master' into 2.3.0

This commit is contained in:
wing328
2017-06-19 11:23:58 +08:00
189 changed files with 9195 additions and 8560 deletions

View File

@@ -16,6 +16,12 @@ import java.util.*;
*/
public final class CodegenConfiguratorUtils {
public static void applySystemPropertiesKvpList(List<String> systemProperties, CodegenConfigurator configurator) {
for(String propString : systemProperties) {
applySystemPropertiesKvp(propString, configurator);
}
}
public static void applySystemPropertiesKvp(String systemProperties, CodegenConfigurator configurator) {
final Map<String, String> map = createMapFromKeyValuePairs(systemProperties);
for (Map.Entry<String, String> entry : map.entrySet()) {
@@ -81,6 +87,4 @@ public final class CodegenConfiguratorUtils {
return result;
}
}

View File

@@ -433,6 +433,10 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
@Override
public String toParamName(String name) {
// don't do name =removeNonNameElementToCamelCase(name); // this breaks connexion, which does not modify param names before sending them
if (reservedWords.contains(name)) {
return escapeReservedWord(name);
}
// Param name is already sanitized in swagger spec processing
return name;
}

View File

@@ -105,7 +105,8 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
modelTestTemplateFiles.put("model_test.mustache", ".js");
apiTemplateFiles.put("api.mustache", ".js");
apiTestTemplateFiles.put("api_test.mustache", ".js");
embeddedTemplateDir = templateDir = "Javascript";
// subfolder Javascript/es6
embeddedTemplateDir = templateDir = "Javascript" + File.separator + "es6";
apiPackage = "api";
modelPackage = "model";
modelDocTemplateFiles.put("model_doc.mustache", ".md");

View File

@@ -235,6 +235,7 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
supportingFiles.add(new SupportingFile("APIHelper.mustache", sourceFolder, "APIHelper.swift"));
supportingFiles.add(new SupportingFile("AlamofireImplementations.mustache", sourceFolder,
"AlamofireImplementations.swift"));
supportingFiles.add(new SupportingFile("Configuration.mustache", sourceFolder, "Configuration.swift"));
supportingFiles.add(new SupportingFile("Extensions.mustache", sourceFolder, "Extensions.swift"));
supportingFiles.add(new SupportingFile("Models.mustache", sourceFolder, "Models.swift"));
supportingFiles.add(new SupportingFile("APIs.mustache", sourceFolder, "APIs.swift"));

View File

@@ -29,14 +29,11 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
public static final String NPM_VERSION = "npmVersion";
public static final String NPM_REPOSITORY = "npmRepository";
public static final String SNAPSHOT = "snapshot";
public static final String USE_OPAQUE_TOKEN = "useOpaqueToken";
public static final String INJECTION_TOKEN = "injectionToken";
public static final String WITH_INTERFACES = "withInterfaces";
protected String npmName = null;
protected String npmVersion = "1.0.0";
protected String npmRepository = null;
protected String injectionToken = "InjectionToken<string>";
public TypeScriptAngular2ClientCodegen() {
super();
@@ -55,7 +52,6 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package"));
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(USE_OPAQUE_TOKEN, "When setting this property to true, OpaqueToken is used instead of InjectionToken", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString()));
}
@@ -92,11 +88,6 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
addNpmPackageGeneration();
}
if(additionalProperties.containsKey(USE_OPAQUE_TOKEN) && Boolean.valueOf(additionalProperties.get(USE_OPAQUE_TOKEN).toString())) {
this.setOpaqueToken();
}
additionalProperties.put(INJECTION_TOKEN, this.injectionToken);
if(additionalProperties.containsKey(WITH_INTERFACES)) {
boolean withInterfaces = Boolean.parseBoolean(additionalProperties.get(WITH_INTERFACES).toString());
if (withInterfaces) {
@@ -338,7 +329,4 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
return camelize(name);
}
public void setOpaqueToken() {
this.injectionToken = "OpaqueToken";
}
}

View File

@@ -2,28 +2,29 @@ package io.swagger.codegen.utils;
import org.apache.commons.lang3.tuple.Pair;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import joptsimple.internal.Strings;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
public class OptionUtils {
public static List<Pair<String, String>> parseCommaSeparatedTuples(String input) {
public static List<Pair<String, String>> parseCommaSeparatedTuples(final String input) {
List<Pair<String, String>> results = new ArrayList<Pair<String, String>>();
final List<Pair<String, String>> results = new ArrayList<Pair<String, String>>();
final List<String> tuples = splitCommaSeparatedList(input);
for (String tuple : tuples) {
int ix = tuple.indexOf('=');
if (ix > 0 && ix < tuple.length() - 1) {
if (ix > 0 && ix <= tuple.length() - 1) {
final Pair<String, String> pair = Pair.of(tuple.substring(0, ix), tuple.substring(ix + 1));
results.add(pair);
} else if (ix < 0){
final Pair<String, String> pair = Pair.of(tuple, "");
results.add(pair);
}
}
//Strings.isNullOrEmpty(input)
return results;
}