forked from loafle/openapi-generator-original
Merge branch '2.3.0' of https://github.com/swagger-api/swagger-codegen into 2.3.0
This commit is contained in:
commit
028cbc77b6
@ -1,10 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# grep for \t in the generators
|
||||
grep -RUIl $'\t$' modules/swagger-codegen/src/main/java/io/swagger/codegen/*.java
|
||||
RESULT=`find modules/swagger-codegen/src/ -name "*.java" | xargs grep $'\t'`
|
||||
|
||||
if [ $? -ne 1 ]; then
|
||||
echo "Generators (Java class files) contain tab '/t'. Please remove it and try again."
|
||||
echo -e "$RESULT"
|
||||
|
||||
if [ "$RESULT" != "" ]; then
|
||||
echo "Java files contain tab '\\t'. Please remove it and try again."
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
@ -34,49 +34,49 @@ public class CodegenParameter {
|
||||
*/
|
||||
public boolean required;
|
||||
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor17.
|
||||
*/
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor17.
|
||||
*/
|
||||
public String maximum;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor17
|
||||
*/
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor17
|
||||
*/
|
||||
public boolean exclusiveMaximum;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor21
|
||||
*/
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor21
|
||||
*/
|
||||
public String minimum;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor21
|
||||
*/
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor21
|
||||
*/
|
||||
public boolean exclusiveMinimum;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor26
|
||||
*/
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor26
|
||||
*/
|
||||
public Integer maxLength;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor29
|
||||
*/
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor29
|
||||
*/
|
||||
public Integer minLength;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor33
|
||||
*/
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor33
|
||||
*/
|
||||
public String pattern;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor42
|
||||
*/
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor42
|
||||
*/
|
||||
public Integer maxItems;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor45
|
||||
*/
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor45
|
||||
*/
|
||||
public Integer minItems;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor49
|
||||
*/
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor49
|
||||
*/
|
||||
public boolean uniqueItems;
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor14
|
||||
*/
|
||||
/**
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor14
|
||||
*/
|
||||
public Number multipleOf;
|
||||
|
||||
public CodegenParameter copy() {
|
||||
|
@ -306,8 +306,8 @@ public class CodegenProperty implements Cloneable {
|
||||
@Override
|
||||
public CodegenProperty clone() {
|
||||
try {
|
||||
CodegenProperty cp = (CodegenProperty) super.clone();
|
||||
if (this._enum != null) {
|
||||
CodegenProperty cp = (CodegenProperty) super.clone();
|
||||
if (this._enum != null) {
|
||||
cp._enum = new ArrayList<String>(this._enum);
|
||||
}
|
||||
if (this.allowableValues != null) {
|
||||
@ -316,10 +316,10 @@ public class CodegenProperty implements Cloneable {
|
||||
if (this.items != null) {
|
||||
cp.items = this.items;
|
||||
}
|
||||
if(this.vendorExtensions != null){
|
||||
if(this.vendorExtensions != null){
|
||||
cp.vendorExtensions = new HashMap<String, Object>(this.vendorExtensions);
|
||||
}
|
||||
return cp;
|
||||
return cp;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import config.ConfigParser;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
|
||||
public class AuthParser {
|
||||
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AuthParser.class);
|
||||
|
||||
public static List<AuthorizationValue> parse(String urlEncodedAuthStr) {
|
||||
@ -25,7 +25,8 @@ public class AuthParser {
|
||||
for (String part : parts) {
|
||||
String[] kvPair = part.split(":");
|
||||
if (kvPair.length == 2) {
|
||||
auths.add(new AuthorizationValue(URLDecoder.decode(kvPair[0]), URLDecoder.decode(kvPair[1]), "header")); // FIXME replace the deprecated method by decode(string, encoding). Which encoding is used ? Default UTF-8 ?
|
||||
// FIXME replace the deprecated method by decode(string, encoding). Which encoding is used ? Default UTF-8 ?
|
||||
auths.add(new AuthorizationValue(URLDecoder.decode(kvPair[0]), URLDecoder.decode(kvPair[1]), "header"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -53,5 +54,4 @@ public class AuthParser {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -614,24 +614,24 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
|
||||
public void setPackageTitle(String packageTitle) {
|
||||
this.packageTitle = packageTitle;
|
||||
}
|
||||
this.packageTitle = packageTitle;
|
||||
}
|
||||
|
||||
public void setPackageProductName(String packageProductName) {
|
||||
this.packageProductName = packageProductName;
|
||||
}
|
||||
this.packageProductName = packageProductName;
|
||||
}
|
||||
|
||||
public void setPackageDescription(String packageDescription) {
|
||||
this.packageDescription = packageDescription;
|
||||
}
|
||||
|
||||
public void setPackageDescription(String packageDescription) {
|
||||
this.packageDescription = packageDescription;
|
||||
}
|
||||
|
||||
public void setPackageCompany(String packageCompany) {
|
||||
this.packageCompany = packageCompany;
|
||||
}
|
||||
this.packageCompany = packageCompany;
|
||||
}
|
||||
|
||||
public void setPackageCopyright(String packageCopyright) {
|
||||
this.packageCopyright = packageCopyright;
|
||||
}
|
||||
this.packageCopyright = packageCopyright;
|
||||
}
|
||||
|
||||
public void setSourceFolder(String sourceFolder) {
|
||||
this.sourceFolder = sourceFolder;
|
||||
|
@ -1,15 +1,25 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
import io.swagger.codegen.*;
|
||||
import io.swagger.codegen.languages.features.BeanValidationFeatures;
|
||||
import io.swagger.models.Operation;
|
||||
import io.swagger.models.Path;
|
||||
import io.swagger.models.Swagger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
import io.swagger.codegen.CliOption;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenParameter;
|
||||
import io.swagger.codegen.CodegenResponse;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.languages.features.BeanValidationFeatures;
|
||||
import io.swagger.codegen.languages.features.UseGenericResponseFeatures;
|
||||
import io.swagger.models.Operation;
|
||||
import io.swagger.models.Path;
|
||||
import io.swagger.models.Swagger;
|
||||
|
||||
public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen implements BeanValidationFeatures {
|
||||
/**
|
||||
@ -25,8 +35,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
||||
|
||||
static Logger LOGGER = LoggerFactory.getLogger(AbstractJavaJAXRSServerCodegen.class);
|
||||
|
||||
public AbstractJavaJAXRSServerCodegen()
|
||||
{
|
||||
public AbstractJavaJAXRSServerCodegen() {
|
||||
super();
|
||||
|
||||
sourceFolder = "src/gen/java";
|
||||
@ -46,7 +55,6 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations"));
|
||||
cliOptions.add(new CliOption("serverPort", "The port on which the server should be started"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -55,8 +63,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
||||
// ===============
|
||||
|
||||
@Override
|
||||
public CodegenType getTag()
|
||||
{
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.SERVER;
|
||||
}
|
||||
|
||||
@ -84,7 +91,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
||||
swagger.setBasePath("");
|
||||
}
|
||||
|
||||
if(!this.additionalProperties.containsKey("serverPort")) {
|
||||
if (!this.additionalProperties.containsKey("serverPort")) {
|
||||
final String host = swagger.getHost();
|
||||
String port = "8080"; // Default value for a JEE Server
|
||||
if ( host != null ) {
|
||||
@ -235,4 +242,5 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
||||
this.useBeanValidation = useBeanValidation;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objMap) {
|
||||
return super.postProcessModels(objMap);
|
||||
return super.postProcessModels(objMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,19 +11,22 @@ import org.slf4j.LoggerFactory;
|
||||
import io.swagger.codegen.CliOption;
|
||||
import io.swagger.codegen.CodegenModel;
|
||||
import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenParameter;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.CodegenResponse;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
import io.swagger.codegen.languages.features.BeanValidationFeatures;
|
||||
import io.swagger.codegen.languages.features.GzipTestFeatures;
|
||||
import io.swagger.codegen.languages.features.JaxbFeatures;
|
||||
import io.swagger.codegen.languages.features.LoggingTestFeatures;
|
||||
import io.swagger.codegen.languages.features.UseGenericResponseFeatures;
|
||||
import io.swagger.models.Operation;
|
||||
|
||||
public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
implements BeanValidationFeatures, JaxbFeatures, GzipTestFeatures, LoggingTestFeatures
|
||||
{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JavaCXFClientCodegen.class);
|
||||
implements BeanValidationFeatures, UseGenericResponseFeatures, JaxbFeatures, GzipTestFeatures, LoggingTestFeatures {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JavaCXFClientCodegen.class);
|
||||
|
||||
/**
|
||||
* Name of the sub-directory in "src/main/resource" where to find the
|
||||
@ -34,6 +37,8 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
protected boolean useJaxbAnnotations = true;
|
||||
|
||||
protected boolean useBeanValidation = false;
|
||||
|
||||
protected boolean useGenericResponse = false;
|
||||
|
||||
protected boolean useGzipFeatureForTests = false;
|
||||
|
||||
@ -75,7 +80,7 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE_FOR_TESTS, "Use Gzip Feature for tests"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_LOGGING_FEATURE_FOR_TESTS, "Use Logging Feature for tests"));
|
||||
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_GENERIC_RESPONSE, "Use generic response"));
|
||||
}
|
||||
|
||||
|
||||
@ -93,6 +98,14 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
boolean useBeanValidationProp = convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION);
|
||||
this.setUseBeanValidation(useBeanValidationProp);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(USE_GENERIC_RESPONSE)) {
|
||||
this.setUseGenericResponse(convertPropertyToBoolean(USE_GENERIC_RESPONSE));
|
||||
}
|
||||
|
||||
if (useGenericResponse) {
|
||||
writePropertyBack(USE_GENERIC_RESPONSE, useGenericResponse);
|
||||
}
|
||||
|
||||
this.setUseGzipFeatureForTests(convertPropertyToBooleanAndWriteBack(USE_GZIP_FEATURE_FOR_TESTS));
|
||||
this.setUseLoggingFeatureForTests(convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE_FOR_TESTS));
|
||||
@ -132,6 +145,28 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
model.imports.remove("ToStringSerializer");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||
objs = super.postProcessOperations(objs);
|
||||
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
if (operations != null) {
|
||||
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation operation : ops) {
|
||||
|
||||
if (operation.returnType == null) {
|
||||
operation.returnType = "void";
|
||||
// set vendorExtensions.x-java-is-response-void to true as
|
||||
// returnType is set to "void"
|
||||
operation.vendorExtensions.put("x-java-is-response-void", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return operations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp()
|
||||
{
|
||||
@ -155,4 +190,8 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
this.useLoggingFeatureForTests = useLoggingFeatureForTests;
|
||||
}
|
||||
|
||||
public void setUseGenericResponse(boolean useGenericResponse) {
|
||||
this.useGenericResponse = useGenericResponse;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,10 +17,11 @@ import io.swagger.codegen.languages.features.CXFServerFeatures;
|
||||
import io.swagger.codegen.languages.features.GzipTestFeatures;
|
||||
import io.swagger.codegen.languages.features.JaxbFeatures;
|
||||
import io.swagger.codegen.languages.features.LoggingTestFeatures;
|
||||
import io.swagger.codegen.languages.features.UseGenericResponseFeatures;
|
||||
import io.swagger.models.Operation;
|
||||
|
||||
public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
implements CXFServerFeatures, GzipTestFeatures, LoggingTestFeatures, JaxbFeatures
|
||||
implements CXFServerFeatures, GzipTestFeatures, LoggingTestFeatures, JaxbFeatures, UseGenericResponseFeatures
|
||||
{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JavaCXFServerCodegen.class);
|
||||
|
||||
@ -58,6 +59,8 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
|
||||
protected boolean generateNonSpringApplication = false;
|
||||
|
||||
protected boolean useGenericResponse = false;
|
||||
|
||||
public JavaCXFServerCodegen()
|
||||
{
|
||||
super();
|
||||
@ -111,6 +114,8 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
cliOptions.add(CliOption.newBoolean(USE_ANNOTATED_BASE_PATH, "Use @Path annotations for basePath"));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(GENERATE_NON_SPRING_APPLICATION, "Generate non-Spring application"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_GENERIC_RESPONSE, "Use generic response"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -127,6 +132,14 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
if (additionalProperties.containsKey(ADD_CONSUMES_PRODUCES_JSON)) {
|
||||
this.setAddConsumesProducesJson(convertPropertyToBooleanAndWriteBack(ADD_CONSUMES_PRODUCES_JSON));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(USE_GENERIC_RESPONSE)) {
|
||||
this.setUseGenericResponse(convertPropertyToBoolean(USE_GENERIC_RESPONSE));
|
||||
}
|
||||
|
||||
if (useGenericResponse) {
|
||||
writePropertyBack(USE_GENERIC_RESPONSE, useGenericResponse);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(GENERATE_SPRING_APPLICATION)) {
|
||||
this.setGenerateSpringApplication(convertPropertyToBooleanAndWriteBack(GENERATE_SPRING_APPLICATION));
|
||||
@ -306,5 +319,9 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
public void setGenerateNonSpringApplication(boolean generateNonSpringApplication) {
|
||||
this.generateNonSpringApplication = generateNonSpringApplication;
|
||||
}
|
||||
|
||||
public void setUseGenericResponse(boolean useGenericResponse) {
|
||||
this.useGenericResponse = useGenericResponse;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -176,6 +176,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
if ("feign".equals(getLibrary())) {
|
||||
additionalProperties.put("jackson", "true");
|
||||
supportingFiles.add(new SupportingFile("ParamExpander.mustache", invokerFolder, "ParamExpander.java"));
|
||||
supportingFiles.add(new SupportingFile("EncodingUtils.mustache", invokerFolder, "EncodingUtils.java"));
|
||||
} else if ("okhttp-gson".equals(getLibrary()) || StringUtils.isEmpty(getLibrary())) {
|
||||
// the "okhttp-gson" library template requires "ApiCallback.mustache" for async call
|
||||
supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java"));
|
||||
@ -247,14 +248,14 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||
super.postProcessOperations(objs);
|
||||
if(usesAnyRetrofitLibrary()) {
|
||||
if (usesAnyRetrofitLibrary()) {
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
if (operations != null) {
|
||||
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation operation : ops) {
|
||||
if (operation.hasConsumes == Boolean.TRUE) {
|
||||
|
||||
if ( isMultipartType(operation.consumes) ) {
|
||||
if (isMultipartType(operation.consumes)) {
|
||||
operation.isMultipart = Boolean.TRUE;
|
||||
}
|
||||
else {
|
||||
@ -269,6 +270,27 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// camelize path variables for Feign client
|
||||
if ("feign".equals(getLibrary())) {
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
String path = new String(op.path);
|
||||
String[] items = path.split("/", -1);
|
||||
String opsPath = "";
|
||||
int pathParamIndex = 0;
|
||||
|
||||
for (int i = 0; i < items.length; ++i) {
|
||||
if (items[i].matches("^\\{(.*)\\}$")) { // wrap in {}
|
||||
// camelize path variable
|
||||
items[i] = "{" + camelize(items[i].substring(1, items[i].length()-1), true) + "}";
|
||||
}
|
||||
}
|
||||
op.path = StringUtils.join(items, "/");
|
||||
}
|
||||
}
|
||||
|
||||
return objs;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import io.swagger.codegen.SupportingFile;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@ -20,6 +21,7 @@ public class ScalaClientCodegen extends AbstractScalaCodegen implements CodegenC
|
||||
protected String groupId = "io.swagger";
|
||||
protected String artifactId = "swagger-scala-client";
|
||||
protected String artifactVersion = "1.0.0";
|
||||
protected String clientName = "AsyncClient";
|
||||
|
||||
public ScalaClientCodegen() {
|
||||
super();
|
||||
@ -51,10 +53,13 @@ public class ScalaClientCodegen extends AbstractScalaCodegen implements CodegenC
|
||||
additionalProperties.put("asyncHttpClient", asyncHttpClient);
|
||||
additionalProperties.put("authScheme", authScheme);
|
||||
additionalProperties.put("authPreemptive", authPreemptive);
|
||||
additionalProperties.put("clientName", clientName);
|
||||
|
||||
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||
supportingFiles.add(new SupportingFile("apiInvoker.mustache",
|
||||
(sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), "ApiInvoker.scala"));
|
||||
supportingFiles.add(new SupportingFile("client.mustache",
|
||||
(sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), clientName + ".scala"));
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||
// gradle settings
|
||||
@ -75,8 +80,8 @@ public class ScalaClientCodegen extends AbstractScalaCodegen implements CodegenC
|
||||
importMapping.remove("Set");
|
||||
importMapping.remove("Map");
|
||||
|
||||
importMapping.put("DateTime", "org.joda.time.DateTime");
|
||||
importMapping.put("ListBuffer", "scala.collection.mutable.ListBuffer");
|
||||
importMapping.put("Date", "java.util.Date");
|
||||
importMapping.put("ListBuffer", "scala.collections.mutable.ListBuffer");
|
||||
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping.put("enum", "NSString");
|
||||
@ -90,7 +95,6 @@ public class ScalaClientCodegen extends AbstractScalaCodegen implements CodegenC
|
||||
typeMapping.put("byte", "Byte");
|
||||
typeMapping.put("short", "Short");
|
||||
typeMapping.put("char", "Char");
|
||||
typeMapping.put("long", "Long");
|
||||
typeMapping.put("double", "Double");
|
||||
typeMapping.put("object", "Any");
|
||||
typeMapping.put("file", "File");
|
||||
@ -98,6 +102,10 @@ public class ScalaClientCodegen extends AbstractScalaCodegen implements CodegenC
|
||||
// mapped to String as a workaround
|
||||
typeMapping.put("binary", "String");
|
||||
typeMapping.put("ByteArray", "String");
|
||||
typeMapping.put("date-time", "Date");
|
||||
// typeMapping.put("date", "Date");
|
||||
// typeMapping.put("Date", "Date");
|
||||
typeMapping.put("DateTime", "Date");
|
||||
|
||||
instantiationTypes.put("array", "ListBuffer");
|
||||
instantiationTypes.put("map", "HashMap");
|
||||
@ -108,7 +116,6 @@ public class ScalaClientCodegen extends AbstractScalaCodegen implements CodegenC
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.MODEL_PROPERTY_NAMING)) {
|
||||
setModelPropertyNaming((String) additionalProperties.get(CodegenConstants.MODEL_PROPERTY_NAMING));
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
protected boolean swiftUseApiNamespace;
|
||||
protected String[] responseAs = new String[0];
|
||||
protected String sourceFolder = "Classes" + File.separator + "Swaggers";
|
||||
private static final Pattern PATH_PARAM_PATTERN = Pattern.compile("\\{[a-zA-Z_]+\\}");
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
@ -454,40 +453,6 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
return codegenModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Model> definitions, Swagger swagger) {
|
||||
path = normalizePath(path); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||
// issue 3914 - removed logic designed to remove any parameter of type HeaderParameter
|
||||
return super.fromOperation(path, httpMethod, operation, definitions, swagger);
|
||||
}
|
||||
|
||||
private static String normalizePath(String path) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
int cursor = 0;
|
||||
Matcher matcher = PATH_PARAM_PATTERN.matcher(path);
|
||||
boolean found = matcher.find();
|
||||
while (found) {
|
||||
String stringBeforeMatch = path.substring(cursor, matcher.start());
|
||||
builder.append(stringBeforeMatch);
|
||||
|
||||
String group = matcher.group().substring(1, matcher.group().length() - 1);
|
||||
group = camelize(group, true);
|
||||
builder
|
||||
.append("{")
|
||||
.append(group)
|
||||
.append("}");
|
||||
|
||||
cursor = matcher.end();
|
||||
found = matcher.find();
|
||||
}
|
||||
|
||||
String stringAfterMatch = path.substring(cursor);
|
||||
builder.append(stringAfterMatch);
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
@ -8,39 +8,39 @@ import io.swagger.models.properties.Property;
|
||||
|
||||
public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCodegen {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "typescript-angular";
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return "typescript-angular";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates a TypeScript AngularJS client library.";
|
||||
}
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates a TypeScript AngularJS client library.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
supportingFiles.add(new SupportingFile("models.mustache", modelPackage().replace('.', File.separatorChar), "models.ts"));
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
supportingFiles.add(new SupportingFile("models.mustache", modelPackage().replace('.', File.separatorChar), "models.ts"));
|
||||
supportingFiles.add(new SupportingFile("apis.mustache", apiPackage().replace('.', File.separatorChar), "api.ts"));
|
||||
supportingFiles.add(new SupportingFile("index.mustache", getIndexDirectory(), "index.ts"));
|
||||
supportingFiles.add(new SupportingFile("api.module.mustache", getIndexDirectory(), "api.module.ts"));
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||
supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore"));
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||
supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore"));
|
||||
|
||||
}
|
||||
|
||||
public TypeScriptAngularClientCodegen() {
|
||||
super();
|
||||
outputFolder = "generated-code/typescript-angular";
|
||||
modelTemplateFiles.put("model.mustache", ".ts");
|
||||
}
|
||||
|
||||
public TypeScriptAngularClientCodegen() {
|
||||
super();
|
||||
outputFolder = "generated-code/typescript-angular";
|
||||
modelTemplateFiles.put("model.mustache", ".ts");
|
||||
apiTemplateFiles.put("api.mustache", ".ts");
|
||||
embeddedTemplateDir = templateDir = "typescript-angular";
|
||||
apiPackage = "api";
|
||||
embeddedTemplateDir = templateDir = "typescript-angular";
|
||||
apiPackage = "api";
|
||||
modelPackage = "model";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public String getSwaggerType(Property p) {
|
||||
String swaggerType = super.getSwaggerType(p);
|
||||
if(isLanguagePrimitive(swaggerType) || isLanguageGenericType(swaggerType)) {
|
||||
@ -49,18 +49,18 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
||||
return addModelPrefix(swaggerType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void postProcessParameter(CodegenParameter parameter) {
|
||||
super.postProcessParameter(parameter);
|
||||
parameter.dataType = addModelPrefix(parameter.dataType);
|
||||
}
|
||||
|
||||
private String getIndexDirectory() {
|
||||
private String getIndexDirectory() {
|
||||
String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.')));
|
||||
return indexPackage.replace('.', File.separatorChar);
|
||||
}
|
||||
|
||||
private String addModelPrefix(String swaggerType) {
|
||||
private String addModelPrefix(String swaggerType) {
|
||||
String type = null;
|
||||
if (typeMapping.containsKey(swaggerType)) {
|
||||
type = typeMapping.get(swaggerType);
|
||||
@ -74,7 +74,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
||||
return type;
|
||||
}
|
||||
|
||||
private boolean isLanguagePrimitive(String type) {
|
||||
private boolean isLanguagePrimitive(String type) {
|
||||
return languageSpecificPrimitives.contains(type);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
package io.swagger.codegen.languages.features;
|
||||
|
||||
public interface UseGenericResponseFeatures {
|
||||
|
||||
// Language supports generating generic Jaxrs or native return types
|
||||
public static final String USE_GENERIC_RESPONSE = "useGenericResponse";
|
||||
|
||||
public void setUseGenericResponse(boolean useGenericResponse);
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package {{invokerPackage}};
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Utilities to support Swagger encoding formats in Feign.
|
||||
*/
|
||||
public final class EncodingUtils {
|
||||
|
||||
/**
|
||||
* Private constructor. Do not construct this class.
|
||||
*/
|
||||
private EncodingUtils() {}
|
||||
|
||||
/**
|
||||
* <p>Encodes a collection of query parameters according to the Swagger
|
||||
* collection format.</p>
|
||||
*
|
||||
* <p>Of the various collection formats defined by Swagger ("csv", "tsv",
|
||||
* etc), Feign only natively supports "multi". This utility generates the
|
||||
* other format types so it will be properly processed by Feign.</p>
|
||||
*
|
||||
* <p>Note, as part of reformatting, it URL encodes the parameters as
|
||||
* well.</p>
|
||||
* @param parameters The collection object to be formatted. This object will
|
||||
* not be changed.
|
||||
* @param collectionFormat The Swagger collection format (eg, "csv", "tsv",
|
||||
* "pipes"). See the
|
||||
* <a href="http://swagger.io/specification/#parameter-object-44">
|
||||
* Swagger Spec</a> for more details.
|
||||
* @return An object that will be correctly formatted by Feign.
|
||||
*/
|
||||
public static Object encodeCollection(Collection<?> parameters,
|
||||
String collectionFormat) {
|
||||
if (parameters == null) {
|
||||
return parameters;
|
||||
}
|
||||
List<String> stringValues = new ArrayList<>(parameters.size());
|
||||
for (Object parameter : parameters) {
|
||||
// ignore null values (same behavior as Feign)
|
||||
if (parameter != null) {
|
||||
stringValues.add(encode(parameter));
|
||||
}
|
||||
}
|
||||
// Feign natively handles single-element lists and the "multi" format.
|
||||
if (stringValues.size() < 2 || "multi".equals(collectionFormat)) {
|
||||
return stringValues;
|
||||
}
|
||||
// Otherwise return a formatted String
|
||||
String[] stringArray = stringValues.toArray(new String[0]);
|
||||
switch (collectionFormat) {
|
||||
case "csv":
|
||||
default:
|
||||
return StringUtil.join(stringArray, ",");
|
||||
case "ssv":
|
||||
return StringUtil.join(stringArray, " ");
|
||||
case "tsv":
|
||||
return StringUtil.join(stringArray, "\t");
|
||||
case "pipes":
|
||||
return StringUtil.join(stringArray, "|");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* URL encode a single query parameter.
|
||||
* @param parameter The query parameter to encode. This object will not be
|
||||
* changed.
|
||||
* @return The URL encoded string representation of the parameter. If the
|
||||
* parameter is null, returns null.
|
||||
*/
|
||||
public static String encode(Object parameter) {
|
||||
if (parameter == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return URLEncoder.encode(parameter.toString(), "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Should never happen, UTF-8 is always supported
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package {{package}};
|
||||
|
||||
import {{invokerPackage}}.ApiClient;
|
||||
import {{invokerPackage}}.EncodingUtils;
|
||||
{{#legacyDates}}
|
||||
import {{invokerPackage}}.ParamExpander;
|
||||
{{/legacyDates}}
|
||||
@ -71,7 +72,7 @@ public interface {{classname}} extends ApiClient.Api {
|
||||
"{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{#hasMore}},
|
||||
{{/hasMore}}{{/headerParams}}
|
||||
})
|
||||
{{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap Map<String, Object> queryParams);
|
||||
{{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||
|
||||
/**
|
||||
* A convenience class for generating query parameters for the
|
||||
@ -80,7 +81,12 @@ public interface {{classname}} extends ApiClient.Api {
|
||||
public static class {{operationIdCamelCase}}QueryParams extends HashMap<String, Object> {
|
||||
{{#queryParams}}
|
||||
public {{operationIdCamelCase}}QueryParams {{paramName}}(final {{{dataType}}} value) {
|
||||
put("{{baseName}}", value);
|
||||
{{#collectionFormat}}
|
||||
put("{{baseName}}", EncodingUtils.encodeCollection(value, "{{collectionFormat}}"));
|
||||
{{/collectionFormat}}
|
||||
{{^collectionFormat}}
|
||||
put("{{baseName}}", EncodingUtils.encode(value));
|
||||
{{/collectionFormat}}
|
||||
return this;
|
||||
}
|
||||
{{/queryParams}}
|
||||
|
@ -246,6 +246,18 @@
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>mockwebserver</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>1.7.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<java.version>{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}</java.version>
|
||||
|
@ -117,7 +117,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
{{#java8}}
|
||||
<source>1.8</source>
|
||||
|
@ -117,7 +117,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
|
@ -118,7 +118,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
{{#java8}}
|
||||
<source>1.8</source>
|
||||
|
@ -31,7 +31,7 @@ public class {{classname}}ServiceImpl implements {{classname}} {
|
||||
public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParamsImpl}}{{>headerParamsImpl}}{{>bodyParamsImpl}}{{>formParamsImpl}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
|
||||
// TODO: Implement...
|
||||
|
||||
{{^vendorExtensions.x-java-is-response-void}}return null;{{/vendorExtensions.x-java-is-response-void}}
|
||||
{{#useGenericResponse}}return Response.ok().entity("magic!").build();{{/useGenericResponse}}{{^useGenericResponse}}{{^vendorExtensions.x-java-is-response-void}}return null;{{/vendorExtensions.x-java-is-response-void}}{{/useGenericResponse}}
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
|
@ -26,12 +26,16 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
|
||||
}
|
||||
|
||||
@Override
|
||||
{{#jackson}}
|
||||
@JsonValue
|
||||
{{/jackson}}
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
{{#jackson}}
|
||||
@JsonCreator
|
||||
{{/jackson}}
|
||||
public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
|
||||
for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
@ -40,4 +44,5 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1 +1,4 @@
|
||||
{{#returnContainer}}{{#isMapContainer}}Map<String, {{{returnType}}}>{{/isMapContainer}}{{#isListContainer}}List<{{{returnType}}}>{{/isListContainer}}{{/returnContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}}
|
||||
{{#useGenericResponse}}Response{{/useGenericResponse}}{{! non-generic response:
|
||||
}}{{^useGenericResponse}}{{!
|
||||
}}{{#returnContainer}}{{#isMapContainer}}Map<String, {{{returnType}}}>{{/isMapContainer}}{{#isListContainer}}List<{{{returnType}}}>{{/isListContainer}}{{/returnContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}}{{!
|
||||
}}{{/useGenericResponse}}
|
@ -104,11 +104,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>
|
||||
1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -98,10 +98,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
@ -23,3 +23,4 @@ class {{clientName}}(config: SwaggerConfig) extends Closeable {
|
||||
client.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,10 +78,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
@ -22,5 +22,5 @@ copy packages\Fody.1.29.2\Fody.dll bin\Fody.dll
|
||||
copy packages\PropertyChanged.Fody.1.51.3\PropertyChanged.Fody.dll bin\PropertyChanged.Fody.dll
|
||||
copy packages\PropertyChanged.Fody.1.51.3\Lib\dotnet\PropertyChanged.dll bin\PropertyChanged.dll
|
||||
{{/generatePropertyChanged}}
|
||||
%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll;System.ComponentModel.DataAnnotations.dll {{#generatePropertyChanged}}/r:bin\Fody.dll;bin\PropertyChanged.Fody.dll;bin\PropertyChanged.dll{{/generatePropertyChanged}} /target:library /out:bin\IO.Swagger.dll /recurse:src\IO.Swagger\*.cs /doc:bin\IO.Swagger.xml
|
||||
%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll;System.ComponentModel.DataAnnotations.dll {{#generatePropertyChanged}}/r:bin\Fody.dll;bin\PropertyChanged.Fody.dll;bin\PropertyChanged.dll{{/generatePropertyChanged}} /target:library /out:bin\{{packageName}}.dll /recurse:src\{{packageName}}\*.cs /doc:bin\{{packageName}}.xml
|
||||
|
||||
|
@ -7,7 +7,7 @@ wget -nc https://nuget.org/nuget.exe
|
||||
mozroots --import --sync
|
||||
|
||||
echo "[INFO] remove bin/Debug/SwaggerClientTest.dll"
|
||||
rm src/IO.Swagger.Test/bin/Debug/{{{packageName}}}.Test.dll 2> /dev/null
|
||||
rm src/{{{packageName}}}.Test/bin/Debug/{{{packageName}}}.Test.dll 2> /dev/null
|
||||
|
||||
echo "[INFO] install NUnit runners via NuGet"
|
||||
wget -nc https://nuget.org/nuget.exe
|
||||
|
@ -1,10 +1,11 @@
|
||||
{{>licenseInfo}}
|
||||
package {{package}}
|
||||
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
{{#imports}}import {{import}}
|
||||
{{/imports}}
|
||||
import {{invokerPackage}}.ApiInvoker
|
||||
import {{invokerPackage}}.ApiException
|
||||
import {{invokerPackage}}.{ApiInvoker, ApiException}
|
||||
|
||||
import com.sun.jersey.multipart.FormDataMultiPart
|
||||
import com.sun.jersey.multipart.file.FileDataBodyPart
|
||||
@ -16,13 +17,42 @@ import java.util.Date
|
||||
|
||||
import scala.collection.mutable.HashMap
|
||||
|
||||
import com.wordnik.swagger.client._
|
||||
import scala.concurrent.Future
|
||||
import collection.mutable
|
||||
|
||||
import java.net.URI
|
||||
|
||||
import com.wordnik.swagger.client.ClientResponseReaders.Json4sFormatsReader._
|
||||
import com.wordnik.swagger.client.RequestWriters.Json4sFormatsWriter._
|
||||
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.concurrent._
|
||||
import scala.concurrent.duration._
|
||||
import scala.util.{Failure, Success, Try}
|
||||
|
||||
{{#operations}}
|
||||
class {{classname}}(val defBasePath: String = "{{{basePath}}}",
|
||||
defApiInvoker: ApiInvoker = ApiInvoker) {
|
||||
|
||||
implicit val formats = new org.json4s.DefaultFormats {
|
||||
override def dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS+0000")
|
||||
}
|
||||
implicit val stringReader = ClientResponseReaders.StringReader
|
||||
implicit val unitReader = ClientResponseReaders.UnitReader
|
||||
implicit val jvalueReader = ClientResponseReaders.JValueReader
|
||||
implicit val jsonReader = JsonFormatsReader
|
||||
implicit val stringWriter = RequestWriters.StringWriter
|
||||
implicit val jsonWriter = JsonFormatsWriter
|
||||
|
||||
var basePath = defBasePath
|
||||
var apiInvoker = defApiInvoker
|
||||
|
||||
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
|
||||
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
|
||||
|
||||
val config = SwaggerConfig.forUrl(new URI(defBasePath))
|
||||
val client = new RestClient(config)
|
||||
val helper = new {{classname}}AsyncHelper(client, config)
|
||||
|
||||
{{#operation}}
|
||||
/**
|
||||
@ -32,97 +62,82 @@ class {{classname}}(val defBasePath: String = "{{{basePath}}}",
|
||||
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
||||
*/
|
||||
def {{operationId}}({{#allParams}}{{paramName}}: {{#required}}{{dataType}}{{#defaultValue}} /* = {{{defaultValue}}}*/{{/defaultValue}}{{/required}}{{^required}}Option[{{dataType}}]{{#defaultValue}} /* = {{{defaultValue}}}*/{{/defaultValue}}{{^defaultValue}} = None{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}: Option[{{returnType}}]{{/returnType}} = {
|
||||
// create path and map variables
|
||||
val path = "{{{path}}}".replaceAll("\\{format\\}", "json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}",apiInvoker.escape({{paramName}})){{/pathParams}}
|
||||
|
||||
val contentTypes = List({{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}"application/json"{{/consumes}})
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
{{#allParams}}
|
||||
{{#required}}
|
||||
{{^isPrimitiveType}}
|
||||
if ({{paramName}} == null) throw new Exception("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
|
||||
|
||||
{{/isPrimitiveType}}
|
||||
{{#isString}}
|
||||
if ({{paramName}} == null) throw new Exception("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
|
||||
|
||||
{{/isString}}
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
{{#queryParams}}
|
||||
{{#required}}
|
||||
queryParams += "{{baseName}}" -> {{paramName}}.toString
|
||||
{{/required}}
|
||||
{{^required}}
|
||||
{{paramName}}.map(paramVal => queryParams += "{{baseName}}" -> paramVal.toString)
|
||||
{{/required}}
|
||||
{{/queryParams}}
|
||||
|
||||
{{#headerParams}}
|
||||
{{#required}}
|
||||
headerParams += "{{baseName}}" -> {{paramName}}
|
||||
{{/required}}
|
||||
{{^required}}
|
||||
{{paramName}}.map(paramVal => headerParams += "{{baseName}}" -> paramVal)
|
||||
{{/required}}
|
||||
{{/headerParams}}
|
||||
|
||||
var postBody: AnyRef = {{#bodyParam}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}.map(paramVal => paramVal){{/required}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}
|
||||
|
||||
if (contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart
|
||||
{{#formParams}}
|
||||
{{#notFile}}
|
||||
{{#required}}
|
||||
mp.field("{{baseName}}", {{paramName}}.toString, MediaType.MULTIPART_FORM_DATA_TYPE)
|
||||
{{/required}}
|
||||
{{^required}}
|
||||
{{paramName}}.map(paramVal => mp.field("{{baseName}}", paramVal.toString, MediaType.MULTIPART_FORM_DATA_TYPE))
|
||||
{{/required}}
|
||||
{{/notFile}}
|
||||
{{#isFile}}
|
||||
{{#required}}
|
||||
mp.field("{{baseName}}", file.getName)
|
||||
mp.bodyPart(new FileDataBodyPart("{{baseName}}", {{paramName}}, MediaType.MULTIPART_FORM_DATA_TYPE))
|
||||
{{/required}}
|
||||
{{^required}}
|
||||
file.map(fileVal => mp.field("{{baseName}}", fileVal.getName))
|
||||
{{paramName}}.map(paramVal => mp.bodyPart(new FileDataBodyPart("{{baseName}}", paramVal, MediaType.MULTIPART_FORM_DATA_TYPE)))
|
||||
{{/required}}
|
||||
{{/isFile}}
|
||||
{{/formParams}}
|
||||
postBody = mp
|
||||
} else {
|
||||
{{#formParams}}
|
||||
{{#notFile}}
|
||||
{{#required}}
|
||||
formParams += "{{baseName}}" -> {{paramName}}.toString
|
||||
{{/required}}
|
||||
{{^required}}
|
||||
{{paramName}}.map(paramVal => formParams += "{{baseName}}" -> paramVal.toString)
|
||||
{{/required}}
|
||||
{{/notFile}}
|
||||
{{/formParams}}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "{{httpMethod}}", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
{{#returnType}} Some(apiInvoker.deserialize(s, "{{returnContainer}}", classOf[{{returnBaseType}}]).asInstanceOf[{{returnType}}])
|
||||
{{/returnType}}
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
val await = Try(Await.result({{operationId}}Async({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}), Duration.Inf))
|
||||
await match {
|
||||
case Success(i) => Some(await.get)
|
||||
case Failure(t) => None
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {{summary}} asynchronously
|
||||
* {{notes}}
|
||||
{{#allParams}} * @param {{paramName}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
||||
{{/allParams}} * @return Future({{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}})
|
||||
*/
|
||||
def {{operationId}}Async({{#allParams}}{{paramName}}: {{#required}}{{dataType}}{{#defaultValue}} /* = {{{defaultValue}}}*/{{/defaultValue}}{{/required}}{{^required}}Option[{{dataType}}]{{#defaultValue}} /* = {{{defaultValue}}}*/{{/defaultValue}}{{^defaultValue}} = None{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}} = {
|
||||
helper.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||
}
|
||||
|
||||
|
||||
{{/operation}}
|
||||
}
|
||||
|
||||
class {{classname}}AsyncHelper(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||
|
||||
{{#operation}}
|
||||
def {{operationId}}({{#allParams}}{{^required}}{{paramName}}: Option[{{dataType}}] = {{#defaultValue}}Some({{defaultValue}}){{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{#hasMore}},{{/hasMore}}
|
||||
{{/required}}{{#required}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}},
|
||||
{{/hasMore}}{{/required}}{{/allParams}})(implicit reader: ClientResponseReader[{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}]{{#bodyParams}}, writer: RequestWriter[{{dataType}}]{{/bodyParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}}{{^returnType}}: Future[Unit]{{/returnType}} = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("{{path}}"){{#pathParams}}
|
||||
replaceAll ("\\{" + "{{baseName}}" + "\\}",{{paramName}}.toString){{/pathParams}})
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
{{#allParams}}
|
||||
{{#required}}
|
||||
{{^isPrimitiveType}}
|
||||
if ({{paramName}} == null) throw new Exception("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
|
||||
{{/isPrimitiveType}}
|
||||
{{#isString}}
|
||||
if ({{paramName}} == null) throw new Exception("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
|
||||
|
||||
{{/isString}}
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
{{#queryParams}}
|
||||
{{^required}}
|
||||
{{paramName}} match {
|
||||
case Some(param) => queryParams += "{{baseName}}" -> param.toString
|
||||
case _ => queryParams
|
||||
}
|
||||
{{/required}}
|
||||
{{#required}}
|
||||
queryParams += "{{baseName}}" -> {{paramName}}.toString
|
||||
{{/required}}
|
||||
{{/queryParams}}
|
||||
{{#headerParams}}
|
||||
{{^required}}
|
||||
{{paramName}} match {
|
||||
case Some(param) => headerParams += "{{baseName}}" -> param.toString
|
||||
case _ => headerParams
|
||||
}
|
||||
{{/required}}
|
||||
{{#required}}
|
||||
headerParams += "{{baseName}}" -> {{paramName}}.toString
|
||||
{{/required}}
|
||||
{{/headerParams}}
|
||||
|
||||
val resFuture = client.submit("{{httpMethod}}", path, queryParams.toMap, headerParams.toMap, {{#bodyParam}}writer.write({{paramName}}){{/bodyParam}}{{^bodyParam}}"{{emptyBodyParam}}"{{/bodyParam}})
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
|
||||
}
|
||||
{{/operations}}
|
||||
|
@ -104,6 +104,12 @@ ext {
|
||||
jackson_version = "2.4.2"
|
||||
junit_version = "4.8.1"
|
||||
scala_test_version = "2.2.4"
|
||||
swagger_async_httpclient_version = "0.3.5"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -117,4 +123,5 @@ dependencies {
|
||||
testCompile "junit:junit:$junit_version"
|
||||
compile "joda-time:joda-time:$jodatime_version"
|
||||
compile "org.joda:joda-convert:$joda_version"
|
||||
compile "com.wordnik.swagger:swagger-async-httpclient_2.10:$swagger_async_httpclient_version"
|
||||
}
|
||||
|
@ -1,33 +1,34 @@
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
version := "{{artifactVersion}}",
|
||||
name := "{{artifactId}}",
|
||||
organization := "{{groupId}}",
|
||||
scalaVersion := "2.11.8",
|
||||
version := "{{artifactVersion}}"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.4.2",
|
||||
"com.sun.jersey" % "jersey-core" % "1.19",
|
||||
"com.sun.jersey" % "jersey-client" % "1.19",
|
||||
"com.sun.jersey.contribs" % "jersey-multipart" % "1.19",
|
||||
"org.jfarcand" % "jersey-ahc-client" % "1.0.5",
|
||||
"io.swagger" % "swagger-core" % "1.5.8",
|
||||
"joda-time" % "joda-time" % "2.2",
|
||||
"org.joda" % "joda-convert" % "1.2",
|
||||
"org.scalatest" %% "scalatest" % "2.2.4" % "test",
|
||||
"junit" % "junit" % "4.8.1" % "test"
|
||||
),
|
||||
name := "{{artifactId}}"
|
||||
|
||||
resolvers ++= Seq(
|
||||
Resolver.jcenterRepo,
|
||||
Resolver.mavenLocal
|
||||
),
|
||||
organization := "{{groupId}}"
|
||||
|
||||
scalacOptions := Seq(
|
||||
"-unchecked",
|
||||
"-deprecation",
|
||||
"-feature"
|
||||
),
|
||||
scalaVersion := "2.11.8"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.4.2",
|
||||
"com.sun.jersey" % "jersey-core" % "1.19",
|
||||
"com.sun.jersey" % "jersey-client" % "1.19",
|
||||
"com.sun.jersey.contribs" % "jersey-multipart" % "1.19",
|
||||
"org.jfarcand" % "jersey-ahc-client" % "1.0.5",
|
||||
"io.swagger" % "swagger-core" % "1.5.8",
|
||||
"joda-time" % "joda-time" % "2.2",
|
||||
"org.joda" % "joda-convert" % "1.2",
|
||||
"org.scalatest" %% "scalatest" % "2.2.4" % "test",
|
||||
"junit" % "junit" % "4.8.1" % "test",
|
||||
"com.wordnik.swagger" %% "swagger-async-httpclient" % "0.3.5"
|
||||
)
|
||||
|
||||
resolvers ++= Seq(
|
||||
Resolver.mavenLocal
|
||||
)
|
||||
|
||||
scalacOptions := Seq(
|
||||
"-unchecked",
|
||||
"-deprecation",
|
||||
"-feature"
|
||||
)
|
||||
|
||||
publishArtifact in (Compile, packageDoc) := false
|
||||
|
||||
publishArtifact in (Compile, packageDoc) := false
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
package {{invokerPackage}}
|
||||
|
||||
{{#imports}}import {{import}}
|
||||
{{/imports}}
|
||||
import {{apiPackage}}._
|
||||
|
||||
import com.wordnik.swagger.client._
|
||||
|
||||
import java.io.Closeable
|
||||
|
||||
class {{clientName}}(config: SwaggerConfig) extends Closeable {
|
||||
val locator = config.locator
|
||||
val name = config.name
|
||||
|
||||
private[this] val client = transportClient
|
||||
|
||||
protected def transportClient: TransportClient = new RestClient(config)
|
||||
|
||||
def close() {
|
||||
client.close()
|
||||
}
|
||||
}
|
@ -103,10 +103,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@ -209,6 +209,11 @@
|
||||
<artifactId>joda-convert</artifactId>
|
||||
<version>${joda-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wordnik.swagger</groupId>
|
||||
<artifactId>swagger-async-httpclient_2.10</artifactId>
|
||||
<version>${swagger-async-httpclient-version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<scala-version>2.10.4</scala-version>
|
||||
@ -223,6 +228,7 @@
|
||||
<junit-version>4.8.1</junit-version>
|
||||
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
|
||||
<scala-test-version>2.2.4</scala-test-version>
|
||||
<swagger-async-httpclient-version>0.3.5</swagger-async-httpclient-version>
|
||||
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
@ -1 +1 @@
|
||||
"{{baseName}}": {{paramName}}{{#isInteger}}{{^required}}?{{/required}}.encodeToJSON(){{/isInteger}}{{#isLong}}{{^required}}?{{/required}}.encodeToJSON(){{/isLong}}{{#isEnum}}{{^isContainer}}{{^required}}?{{/required}}.rawValue{{/isContainer}}{{/isEnum}}{{#isDate}}{{^required}}?{{/required}}.encodeToJSON(){{/isDate}}{{#isDateTime}}{{^required}}?{{/required}}.encodeToJSON(){{/isDateTime}}
|
||||
"{{baseName}}": {{paramName}}{{^isEnum}}{{#isInteger}}{{^required}}?{{/required}}.encodeToJSON(){{/isInteger}}{{#isLong}}{{^required}}?{{/required}}.encodeToJSON(){{/isLong}}{{/isEnum}}{{#isEnum}}{{^isContainer}}{{^required}}?{{/required}}.rawValue{{/isContainer}}{{/isEnum}}{{#isDate}}{{^required}}?{{/required}}.encodeToJSON(){{/isDate}}{{#isDateTime}}{{^required}}?{{/required}}.encodeToJSON(){{/isDateTime}}
|
@ -279,7 +279,7 @@ export enum {{classname}}ApiKeys {
|
||||
}
|
||||
|
||||
export class {{classname}} {
|
||||
protected basePath = defaultBasePath;
|
||||
protected _basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
protected _useQuerystring : boolean = false;
|
||||
|
||||
@ -326,6 +326,14 @@ export class {{classname}} {
|
||||
this._useQuerystring = value;
|
||||
}
|
||||
|
||||
set basePath(basePath: string) {
|
||||
this._basePath = basePath;
|
||||
}
|
||||
|
||||
get basePath() {
|
||||
return this._basePath;
|
||||
}
|
||||
|
||||
public setApiKey(key: {{classname}}ApiKeys, value: string) {
|
||||
this.authentications[{{classname}}ApiKeys[key]].apiKey = value;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.swagger.codegen;
|
||||
|
||||
|
||||
import io.swagger.models.*;
|
||||
import io.swagger.models.parameters.BodyParameter;
|
||||
import io.swagger.models.parameters.Parameter;
|
||||
@ -161,7 +160,7 @@ public class InlineModelResolverTest {
|
||||
.name("name")
|
||||
.property("street", new StringProperty())
|
||||
.property("city", new StringProperty())
|
||||
.property("apartment", new StringProperty())));
|
||||
.property("apartment", new StringProperty())));
|
||||
|
||||
new InlineModelResolver().flatten(swagger);
|
||||
|
||||
@ -206,7 +205,7 @@ public class InlineModelResolverTest {
|
||||
Response response = responses.get("200");
|
||||
assertNotNull(response);
|
||||
Property schema = response.getSchema();
|
||||
assertTrue(schema instanceof RefProperty);
|
||||
assertTrue(schema instanceof RefProperty);
|
||||
assertEquals(1, schema.getVendorExtensions().size());
|
||||
assertEquals("ext-prop", schema.getVendorExtensions().get("x-ext"));
|
||||
|
||||
@ -222,7 +221,7 @@ public class InlineModelResolverTest {
|
||||
Swagger swagger = new Swagger();
|
||||
|
||||
String responseTitle = "GetBarResponse";
|
||||
swagger.path("/foo/bar", new Path()
|
||||
swagger.path("/foo/bar", new Path()
|
||||
.get(new Operation()
|
||||
.response(200, new Response()
|
||||
.description("it works!")
|
||||
@ -336,8 +335,8 @@ public class InlineModelResolverTest {
|
||||
|
||||
ModelImpl addressModelItem = new ModelImpl();
|
||||
String addressModelName = "DetailedAddress";
|
||||
addressModelItem.setTitle(addressModelName);
|
||||
swagger.path("/hello", new Path()
|
||||
addressModelItem.setTitle(addressModelName);
|
||||
swagger.path("/hello", new Path()
|
||||
.get(new Operation()
|
||||
.parameter(new BodyParameter()
|
||||
.name("body")
|
||||
@ -436,12 +435,12 @@ public class InlineModelResolverTest {
|
||||
public void resolveInlineArrayResponse() throws Exception {
|
||||
Swagger swagger = new Swagger();
|
||||
|
||||
ArrayProperty schema = new ArrayProperty()
|
||||
.items(new ObjectProperty()
|
||||
.property("name", new StringProperty())
|
||||
.vendorExtension("x-ext", "ext-items"))
|
||||
.vendorExtension("x-ext", "ext-prop");
|
||||
swagger.path("/foo/baz", new Path()
|
||||
ArrayProperty schema = new ArrayProperty()
|
||||
.items(new ObjectProperty()
|
||||
.property("name", new StringProperty())
|
||||
.vendorExtension("x-ext", "ext-items"))
|
||||
.vendorExtension("x-ext", "ext-prop");
|
||||
swagger.path("/foo/baz", new Path()
|
||||
.get(new Operation()
|
||||
.response(200, new Response()
|
||||
.vendorExtension("x-foo", "bar")
|
||||
@ -487,15 +486,14 @@ public class InlineModelResolverTest {
|
||||
Swagger swagger = new Swagger();
|
||||
|
||||
swagger.path("/foo/baz", new Path()
|
||||
.get(new Operation()
|
||||
.response(200, new Response()
|
||||
.vendorExtension("x-foo", "bar")
|
||||
.description("it works!")
|
||||
.schema(new ArrayProperty()
|
||||
.items(
|
||||
new ObjectProperty()
|
||||
.title("FooBar")
|
||||
.property("name", new StringProperty()))))));
|
||||
.get(new Operation()
|
||||
.response(200, new Response()
|
||||
.vendorExtension("x-foo", "bar")
|
||||
.description("it works!")
|
||||
.schema(new ArrayProperty()
|
||||
.items(new ObjectProperty()
|
||||
.title("FooBar")
|
||||
.property("name", new StringProperty()))))));
|
||||
|
||||
new InlineModelResolver().flatten(swagger);
|
||||
|
||||
|
@ -4,6 +4,7 @@ import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.JavaCXFClientCodegen;
|
||||
import io.swagger.codegen.options.JavaCXFClientOptionsProvider;
|
||||
import io.swagger.codegen.options.JavaCXFServerOptionsProvider;
|
||||
import io.swagger.codegen.options.OptionsProvider;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
@ -59,6 +60,9 @@ public class JaxrsCXFClientOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
clientCodegen.setUseBeanValidation(Boolean.valueOf(JavaCXFClientOptionsProvider.USE_BEANVALIDATION));
|
||||
times = 1;
|
||||
clientCodegen.setUseGenericResponse(Boolean.valueOf(JavaCXFClientOptionsProvider.USE_GENERIC_RESPONSE));
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setUseLoggingFeatureForTests(
|
||||
Boolean.valueOf(JavaCXFClientOptionsProvider.USE_LOGGING_FEATURE_FOR_TESTS));
|
||||
times = 1;
|
||||
|
@ -80,6 +80,8 @@ public class JaxrsCXFServerOptionsTest extends AbstractOptionsTest {
|
||||
clientCodegen.setUseBeanValidationFeature(
|
||||
Boolean.valueOf(JavaCXFServerOptionsProvider.USE_BEANVALIDATION_FEATURE));
|
||||
times = 1;
|
||||
clientCodegen.setUseGenericResponse(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_GENERIC_RESPONSE));
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setGenerateSpringBootApplication(
|
||||
Boolean.valueOf(JavaCXFServerOptionsProvider.GENERATE_SPRING_BOOT_APPLICATION));
|
||||
|
@ -10,70 +10,68 @@ import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class JavaClientCodegenTest {
|
||||
|
||||
private static final String VENDOR_MIME_TYPE = "application/vnd.company.v1+json";
|
||||
private static final String XML_MIME_TYPE = "application/xml";
|
||||
private static final String JSON_MIME_TYPE = "application/json";
|
||||
private static final String TEXT_MIME_TYPE = "text/plain";
|
||||
|
||||
@Test
|
||||
public void testJsonMime() {
|
||||
Assert.assertTrue(JavaClientCodegen.isJsonMimeType(JSON_MIME_TYPE));
|
||||
Assert.assertFalse(JavaClientCodegen.isJsonMimeType(XML_MIME_TYPE));
|
||||
Assert.assertFalse(JavaClientCodegen.isJsonMimeType(TEXT_MIME_TYPE));
|
||||
|
||||
Assert.assertTrue(JavaClientCodegen.isJsonVendorMimeType("application/vnd.mycompany+json"));
|
||||
Assert.assertTrue(JavaClientCodegen.isJsonVendorMimeType("application/vnd.mycompany.v1+json"));
|
||||
Assert.assertTrue(JavaClientCodegen.isJsonVendorMimeType("application/vnd.mycompany.resourceTypeA.version1+json"));
|
||||
Assert.assertTrue(JavaClientCodegen.isJsonVendorMimeType("application/vnd.mycompany.resourceTypeB.version2+json"));
|
||||
Assert.assertFalse(JavaClientCodegen.isJsonVendorMimeType("application/v.json"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContentTypePrioritization() {
|
||||
Map<String, String> jsonMimeType = new HashMap<>();
|
||||
jsonMimeType.put(JavaClientCodegen.MEDIA_TYPE, JSON_MIME_TYPE);
|
||||
private static final String VENDOR_MIME_TYPE = "application/vnd.company.v1+json";
|
||||
private static final String XML_MIME_TYPE = "application/xml";
|
||||
private static final String JSON_MIME_TYPE = "application/json";
|
||||
private static final String TEXT_MIME_TYPE = "text/plain";
|
||||
|
||||
Map<String, String> xmlMimeType = new HashMap<>();
|
||||
xmlMimeType.put(JavaClientCodegen.MEDIA_TYPE, XML_MIME_TYPE);
|
||||
@Test
|
||||
public void testJsonMime() {
|
||||
Assert.assertTrue(JavaClientCodegen.isJsonMimeType(JSON_MIME_TYPE));
|
||||
Assert.assertFalse(JavaClientCodegen.isJsonMimeType(XML_MIME_TYPE));
|
||||
Assert.assertFalse(JavaClientCodegen.isJsonMimeType(TEXT_MIME_TYPE));
|
||||
|
||||
Map<String, String> vendorMimeType = new HashMap<>();
|
||||
vendorMimeType.put(JavaClientCodegen.MEDIA_TYPE, VENDOR_MIME_TYPE);
|
||||
Assert.assertTrue(JavaClientCodegen.isJsonVendorMimeType("application/vnd.mycompany+json"));
|
||||
Assert.assertTrue(JavaClientCodegen.isJsonVendorMimeType("application/vnd.mycompany.v1+json"));
|
||||
Assert.assertTrue(JavaClientCodegen.isJsonVendorMimeType("application/vnd.mycompany.resourceTypeA.version1+json"));
|
||||
Assert.assertTrue(JavaClientCodegen.isJsonVendorMimeType("application/vnd.mycompany.resourceTypeB.version2+json"));
|
||||
Assert.assertFalse(JavaClientCodegen.isJsonVendorMimeType("application/v.json"));
|
||||
|
||||
Map<String, String> textMimeType = new HashMap<>();
|
||||
textMimeType.put(JavaClientCodegen.MEDIA_TYPE, TEXT_MIME_TYPE);
|
||||
}
|
||||
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(
|
||||
Collections.<Map<String,String>>emptyList()), Collections.emptyList());
|
||||
@Test
|
||||
public void testContentTypePrioritization() {
|
||||
Map<String, String> jsonMimeType = new HashMap<>();
|
||||
jsonMimeType.put(JavaClientCodegen.MEDIA_TYPE, JSON_MIME_TYPE);
|
||||
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(xmlMimeType)), Arrays.asList(xmlMimeType));
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(jsonMimeType)), Arrays.asList(jsonMimeType));
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(vendorMimeType)), Arrays.asList(vendorMimeType));
|
||||
Map<String, String> xmlMimeType = new HashMap<>();
|
||||
xmlMimeType.put(JavaClientCodegen.MEDIA_TYPE, XML_MIME_TYPE);
|
||||
|
||||
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(xmlMimeType, jsonMimeType)),
|
||||
Arrays.asList(jsonMimeType, xmlMimeType));
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(jsonMimeType, xmlMimeType)),
|
||||
Arrays.asList(jsonMimeType, xmlMimeType));
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(jsonMimeType, vendorMimeType)),
|
||||
Arrays.asList(vendorMimeType, jsonMimeType));
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(textMimeType, xmlMimeType)),
|
||||
Arrays.asList(textMimeType, xmlMimeType));
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(xmlMimeType, textMimeType)),
|
||||
Arrays.asList(xmlMimeType, textMimeType));
|
||||
|
||||
System.out.println(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(
|
||||
xmlMimeType,textMimeType, jsonMimeType, vendorMimeType)));
|
||||
|
||||
List<Map<String,String>> priContentTypes = JavaClientCodegen.prioritizeContentTypes(Arrays.asList(
|
||||
xmlMimeType, textMimeType, jsonMimeType, vendorMimeType));
|
||||
Assert.assertEquals(priContentTypes, Arrays.asList(vendorMimeType, jsonMimeType, xmlMimeType, textMimeType));
|
||||
|
||||
for ( int i = 0; i < 3; i++ )
|
||||
Assert.assertNotNull(priContentTypes.get(i).get("hasMore"));
|
||||
Assert.assertNull(priContentTypes.get(3).get("hasMore"));
|
||||
|
||||
}
|
||||
|
||||
Map<String, String> vendorMimeType = new HashMap<>();
|
||||
vendorMimeType.put(JavaClientCodegen.MEDIA_TYPE, VENDOR_MIME_TYPE);
|
||||
|
||||
Map<String, String> textMimeType = new HashMap<>();
|
||||
textMimeType.put(JavaClientCodegen.MEDIA_TYPE, TEXT_MIME_TYPE);
|
||||
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(
|
||||
Collections.<Map<String,String>>emptyList()), Collections.emptyList());
|
||||
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(xmlMimeType)), Arrays.asList(xmlMimeType));
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(jsonMimeType)), Arrays.asList(jsonMimeType));
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(vendorMimeType)), Arrays.asList(vendorMimeType));
|
||||
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(xmlMimeType, jsonMimeType)),
|
||||
Arrays.asList(jsonMimeType, xmlMimeType));
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(jsonMimeType, xmlMimeType)),
|
||||
Arrays.asList(jsonMimeType, xmlMimeType));
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(jsonMimeType, vendorMimeType)),
|
||||
Arrays.asList(vendorMimeType, jsonMimeType));
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(textMimeType, xmlMimeType)),
|
||||
Arrays.asList(textMimeType, xmlMimeType));
|
||||
Assert.assertEquals(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(xmlMimeType, textMimeType)),
|
||||
Arrays.asList(xmlMimeType, textMimeType));
|
||||
|
||||
System.out.println(JavaClientCodegen.prioritizeContentTypes(Arrays.asList(
|
||||
xmlMimeType,textMimeType, jsonMimeType, vendorMimeType)));
|
||||
|
||||
List<Map<String,String>> priContentTypes = JavaClientCodegen.prioritizeContentTypes(Arrays.asList(
|
||||
xmlMimeType, textMimeType, jsonMimeType, vendorMimeType));
|
||||
Assert.assertEquals(priContentTypes, Arrays.asList(vendorMimeType, jsonMimeType, xmlMimeType, textMimeType));
|
||||
|
||||
for ( int i = 0; i < 3; i++ )
|
||||
Assert.assertNotNull(priContentTypes.get(i).get("hasMore"));
|
||||
|
||||
Assert.assertNull(priContentTypes.get(3).get("hasMore"));
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ public class AspNetCoreServerOptionsProvider implements OptionsProvider {
|
||||
public static final String PACKAGE_NAME_VALUE = "swagger_server_aspnetcore";
|
||||
public static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
public static final String SOURCE_FOLDER_VALUE = "src_aspnetcore";
|
||||
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "aspnetcore";
|
||||
|
@ -16,6 +16,8 @@ public class JavaCXFClientOptionsProvider extends JavaOptionsProvider {
|
||||
|
||||
public static final String USE_LOGGING_FEATURE_FOR_TESTS = "true";
|
||||
|
||||
public static final String USE_GENERIC_RESPONSE = "true";
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
@ -36,6 +38,7 @@ public class JavaCXFClientOptionsProvider extends JavaOptionsProvider {
|
||||
.putAll(parentOptions);
|
||||
|
||||
builder.put(JavaCXFClientCodegen.USE_BEANVALIDATION, JavaCXFClientOptionsProvider.USE_BEANVALIDATION);
|
||||
builder.put(JavaCXFClientCodegen.USE_GENERIC_RESPONSE, JavaCXFClientOptionsProvider.USE_GENERIC_RESPONSE);
|
||||
builder.put(JavaCXFClientCodegen.USE_JAXB_ANNOTATIONS, USE_JAXB_ANNOTATIONS);
|
||||
|
||||
builder.put(JavaCXFClientCodegen.USE_GZIP_FEATURE_FOR_TESTS, USE_GZIP_FEATURE_FOR_TESTS);
|
||||
|
@ -31,6 +31,8 @@ public class JavaCXFServerOptionsProvider extends JavaOptionsProvider {
|
||||
|
||||
public static final String USE_BEANVALIDATION_FEATURE = "true";
|
||||
|
||||
public static final String USE_GENERIC_RESPONSE = "true";
|
||||
|
||||
public static final String USE_SPRING_ANNOTATION_CONFIG = "true";
|
||||
|
||||
public static final String GENERATE_SPRING_BOOT_APPLICATION = "true";
|
||||
@ -82,6 +84,7 @@ public class JavaCXFServerOptionsProvider extends JavaOptionsProvider {
|
||||
builder.put(JavaCXFServerCodegen.USE_LOGGING_FEATURE, USE_LOGGING_FEATURE);
|
||||
builder.put(JavaCXFServerCodegen.USE_LOGGING_FEATURE_FOR_TESTS, USE_LOGGING_FEATURE_FOR_TESTS);
|
||||
builder.put(JavaCXFServerCodegen.USE_BEANVALIDATION_FEATURE, USE_BEANVALIDATION_FEATURE);
|
||||
builder.put(JavaCXFServerCodegen.USE_GENERIC_RESPONSE, USE_GENERIC_RESPONSE);
|
||||
|
||||
builder.put(JavaCXFServerCodegen.GENERATE_SPRING_BOOT_APPLICATION, GENERATE_SPRING_BOOT_APPLICATION);
|
||||
|
||||
|
@ -66,10 +66,10 @@ public class ScalaModelTest {
|
||||
Assert.assertEquals(property3.baseName, "createdAt");
|
||||
Assert.assertEquals(property3.getter, "getCreatedAt");
|
||||
Assert.assertEquals(property3.setter, "setCreatedAt");
|
||||
Assert.assertEquals(property3.datatype, "DateTime");
|
||||
Assert.assertEquals(property3.datatype, "Date");
|
||||
Assert.assertEquals(property3.name, "createdAt");
|
||||
Assert.assertEquals(property3.defaultValue, "null");
|
||||
Assert.assertEquals(property3.baseType, "DateTime");
|
||||
Assert.assertEquals(property3.baseType, "Date");
|
||||
Assert.assertFalse(property3.hasMore);
|
||||
Assert.assertFalse(property3.required);
|
||||
Assert.assertTrue(property3.isNotContainer);
|
||||
|
@ -324,7 +324,7 @@ paths:
|
||||
$ref: '#/definitions/Order'
|
||||
'400':
|
||||
description: Invalid Order
|
||||
'/store/order/{orderId}':
|
||||
'/store/order/{order_id}':
|
||||
get:
|
||||
tags:
|
||||
- store
|
||||
@ -335,7 +335,7 @@ paths:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: orderId
|
||||
- name: order_id
|
||||
in: path
|
||||
description: ID of pet that needs to be fetched
|
||||
required: true
|
||||
@ -362,7 +362,7 @@ paths:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: orderId
|
||||
- name: order_id
|
||||
in: path
|
||||
description: ID of the order that needs to be deleted
|
||||
required: true
|
||||
|
@ -27,6 +27,7 @@ import java.io.InputStream;
|
||||
|
||||
{{^supportJava6}}
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
{{/supportJava6}}
|
||||
{{#supportJava6}}
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@ -581,7 +582,7 @@ public class ApiClient {
|
||||
try {
|
||||
File file = prepareDownloadFile(response);
|
||||
{{^supportJava6}}
|
||||
Files.copy(response.readEntity(InputStream.class), file.toPath());
|
||||
Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
{{/supportJava6}}
|
||||
{{#supportJava6}}
|
||||
// Java6 falls back to commons.io for file copying
|
||||
|
2
pom.xml
2
pom.xml
@ -155,7 +155,7 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
|
@ -104,11 +104,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>
|
||||
1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -98,10 +98,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
@ -25,3 +25,4 @@ class SwaggerClient(config: SwaggerConfig) extends Closeable {
|
||||
client.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,7 @@ case $state in
|
||||
deleteOrder)
|
||||
local -a _op_arguments
|
||||
_op_arguments=(
|
||||
"orderId=:[PATH] ID of the order that needs to be deleted"
|
||||
"order_id=:[PATH] ID of the order that needs to be deleted"
|
||||
)
|
||||
_describe -t actions 'operations' _op_arguments -S '' && ret=0
|
||||
;;
|
||||
@ -425,7 +425,7 @@ case $state in
|
||||
getOrderById)
|
||||
local -a _op_arguments
|
||||
_op_arguments=(
|
||||
"orderId=:[PATH] ID of pet that needs to be fetched"
|
||||
"order_id=:[PATH] ID of pet that needs to be fetched"
|
||||
)
|
||||
_describe -t actions 'operations' _op_arguments -S '' && ret=0
|
||||
;;
|
||||
|
@ -103,8 +103,8 @@ operation_parameters_minimum_occurences["updatePetWithForm:::status"]=0
|
||||
operation_parameters_minimum_occurences["uploadFile:::petId"]=1
|
||||
operation_parameters_minimum_occurences["uploadFile:::additionalMetadata"]=0
|
||||
operation_parameters_minimum_occurences["uploadFile:::file"]=0
|
||||
operation_parameters_minimum_occurences["deleteOrder:::orderId"]=1
|
||||
operation_parameters_minimum_occurences["getOrderById:::orderId"]=1
|
||||
operation_parameters_minimum_occurences["deleteOrder:::order_id"]=1
|
||||
operation_parameters_minimum_occurences["getOrderById:::order_id"]=1
|
||||
operation_parameters_minimum_occurences["placeOrder:::body"]=1
|
||||
operation_parameters_minimum_occurences["createUser:::body"]=1
|
||||
operation_parameters_minimum_occurences["createUsersWithArrayInput:::body"]=1
|
||||
@ -160,8 +160,8 @@ operation_parameters_maximum_occurences["updatePetWithForm:::status"]=0
|
||||
operation_parameters_maximum_occurences["uploadFile:::petId"]=0
|
||||
operation_parameters_maximum_occurences["uploadFile:::additionalMetadata"]=0
|
||||
operation_parameters_maximum_occurences["uploadFile:::file"]=0
|
||||
operation_parameters_maximum_occurences["deleteOrder:::orderId"]=0
|
||||
operation_parameters_maximum_occurences["getOrderById:::orderId"]=0
|
||||
operation_parameters_maximum_occurences["deleteOrder:::order_id"]=0
|
||||
operation_parameters_maximum_occurences["getOrderById:::order_id"]=0
|
||||
operation_parameters_maximum_occurences["placeOrder:::body"]=0
|
||||
operation_parameters_maximum_occurences["createUser:::body"]=0
|
||||
operation_parameters_maximum_occurences["createUsersWithArrayInput:::body"]=0
|
||||
@ -214,8 +214,8 @@ operation_parameters_collection_type["updatePetWithForm:::status"]=""
|
||||
operation_parameters_collection_type["uploadFile:::petId"]=""
|
||||
operation_parameters_collection_type["uploadFile:::additionalMetadata"]=""
|
||||
operation_parameters_collection_type["uploadFile:::file"]=""
|
||||
operation_parameters_collection_type["deleteOrder:::orderId"]=""
|
||||
operation_parameters_collection_type["getOrderById:::orderId"]=""
|
||||
operation_parameters_collection_type["deleteOrder:::order_id"]=""
|
||||
operation_parameters_collection_type["getOrderById:::order_id"]=""
|
||||
operation_parameters_collection_type["placeOrder:::body"]=""
|
||||
operation_parameters_collection_type["createUser:::body"]=""
|
||||
operation_parameters_collection_type["createUsersWithArrayInput:::body"]=
|
||||
@ -1434,7 +1434,7 @@ print_deleteOrder_help() {
|
||||
echo -e "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors" | fold -sw 80
|
||||
echo -e ""
|
||||
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
|
||||
echo -e " * $(tput setaf 2)orderId$(tput sgr0) $(tput setaf 4)[String]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - ID of the order that needs to be deleted $(tput setaf 3)Specify as: orderId=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * $(tput setaf 2)order_id$(tput sgr0) $(tput setaf 4)[String]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - ID of the order that needs to be deleted $(tput setaf 3)Specify as: order_id=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo ""
|
||||
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
|
||||
case 400 in
|
||||
@ -1524,7 +1524,7 @@ print_getOrderById_help() {
|
||||
echo -e "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions" | fold -sw 80
|
||||
echo -e ""
|
||||
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
|
||||
echo -e " * $(tput setaf 2)orderId$(tput sgr0) $(tput setaf 4)[Integer]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - ID of pet that needs to be fetched $(tput setaf 3)Specify as: orderId=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * $(tput setaf 2)order_id$(tput sgr0) $(tput setaf 4)[Integer]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - ID of pet that needs to be fetched $(tput setaf 3)Specify as: order_id=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo ""
|
||||
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
|
||||
case 200 in
|
||||
@ -2586,14 +2586,14 @@ call_uploadFile() {
|
||||
#
|
||||
##############################################################################
|
||||
call_deleteOrder() {
|
||||
local path_parameter_names=(orderId)
|
||||
local path_parameter_names=(order_id)
|
||||
local query_parameter_names=()
|
||||
|
||||
if [[ $force = false ]]; then
|
||||
validate_request_parameters "/v2/store/order/{orderId}" path_parameter_names query_parameter_names
|
||||
validate_request_parameters "/v2/store/order/{order_id}" path_parameter_names query_parameter_names
|
||||
fi
|
||||
|
||||
local path=$(build_request_path "/v2/store/order/{orderId}" path_parameter_names query_parameter_names)
|
||||
local path=$(build_request_path "/v2/store/order/{order_id}" path_parameter_names query_parameter_names)
|
||||
local method="DELETE"
|
||||
local headers_curl=$(header_arguments_to_curl)
|
||||
if [[ -n $header_accept ]]; then
|
||||
@ -2648,14 +2648,14 @@ call_getInventory() {
|
||||
#
|
||||
##############################################################################
|
||||
call_getOrderById() {
|
||||
local path_parameter_names=(orderId)
|
||||
local path_parameter_names=(order_id)
|
||||
local query_parameter_names=()
|
||||
|
||||
if [[ $force = false ]]; then
|
||||
validate_request_parameters "/v2/store/order/{orderId}" path_parameter_names query_parameter_names
|
||||
validate_request_parameters "/v2/store/order/{order_id}" path_parameter_names query_parameter_names
|
||||
fi
|
||||
|
||||
local path=$(build_request_path "/v2/store/order/{orderId}" path_parameter_names query_parameter_names)
|
||||
local path=$(build_request_path "/v2/store/order/{order_id}" path_parameter_names query_parameter_names)
|
||||
local method="GET"
|
||||
local headers_curl=$(header_arguments_to_curl)
|
||||
if [[ -n $header_accept ]]; then
|
||||
|
@ -108,9 +108,9 @@ _petstore-cli()
|
||||
operation_parameters["updatePet"]=""
|
||||
operation_parameters["updatePetWithForm"]="petId= "
|
||||
operation_parameters["uploadFile"]="petId= "
|
||||
operation_parameters["deleteOrder"]="orderId= "
|
||||
operation_parameters["deleteOrder"]="order_id= "
|
||||
operation_parameters["getInventory"]=""
|
||||
operation_parameters["getOrderById"]="orderId= "
|
||||
operation_parameters["getOrderById"]="order_id= "
|
||||
operation_parameters["placeOrder"]=""
|
||||
operation_parameters["createUser"]=""
|
||||
operation_parameters["createUsersWithArrayInput"]=""
|
||||
|
@ -84,9 +84,9 @@ Class | Method | HTTP request | Description
|
||||
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
||||
*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
|
||||
*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
[**PlaceOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -241,7 +241,7 @@ namespace IO.Swagger.Api
|
||||
if (orderId == null)
|
||||
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder");
|
||||
|
||||
var localVarPath = "./store/order/{orderId}";
|
||||
var localVarPath = "./store/order/{order_id}";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new Dictionary<String, String>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
@ -263,7 +263,7 @@ namespace IO.Swagger.Api
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (orderId != null) localVarPathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
@ -376,7 +376,7 @@ namespace IO.Swagger.Api
|
||||
if (orderId == null)
|
||||
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->GetOrderById");
|
||||
|
||||
var localVarPath = "./store/order/{orderId}";
|
||||
var localVarPath = "./store/order/{order_id}";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new Dictionary<String, String>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
@ -398,7 +398,7 @@ namespace IO.Swagger.Api
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (orderId != null) localVarPathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
|
@ -105,9 +105,9 @@ Class | Method | HTTP request | Description
|
||||
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
||||
*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
|
||||
*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
[**PlaceOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -325,7 +325,7 @@ namespace IO.Swagger.Api
|
||||
if (orderId == null)
|
||||
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder");
|
||||
|
||||
var localVarPath = "/store/order/{orderId}";
|
||||
var localVarPath = "/store/order/{order_id}";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new Dictionary<String, String>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
@ -347,7 +347,7 @@ namespace IO.Swagger.Api
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (orderId != null) localVarPathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
@ -393,7 +393,7 @@ namespace IO.Swagger.Api
|
||||
if (orderId == null)
|
||||
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder");
|
||||
|
||||
var localVarPath = "/store/order/{orderId}";
|
||||
var localVarPath = "/store/order/{order_id}";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new Dictionary<String, String>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
@ -415,7 +415,7 @@ namespace IO.Swagger.Api
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (orderId != null) localVarPathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
@ -595,7 +595,7 @@ namespace IO.Swagger.Api
|
||||
if (orderId == null)
|
||||
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->GetOrderById");
|
||||
|
||||
var localVarPath = "/store/order/{orderId}";
|
||||
var localVarPath = "/store/order/{order_id}";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new Dictionary<String, String>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
@ -617,7 +617,7 @@ namespace IO.Swagger.Api
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (orderId != null) localVarPathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
@ -664,7 +664,7 @@ namespace IO.Swagger.Api
|
||||
if (orderId == null)
|
||||
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->GetOrderById");
|
||||
|
||||
var localVarPath = "/store/order/{orderId}";
|
||||
var localVarPath = "/store/order/{order_id}";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new Dictionary<String, String>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
@ -686,7 +686,7 @@ namespace IO.Swagger.Api
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (orderId != null) localVarPathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
|
@ -105,9 +105,9 @@ Class | Method | HTTP request | Description
|
||||
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
||||
*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
|
||||
*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
[**PlaceOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -325,7 +325,7 @@ namespace IO.Swagger.Api
|
||||
if (orderId == null)
|
||||
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder");
|
||||
|
||||
var localVarPath = "/store/order/{orderId}";
|
||||
var localVarPath = "/store/order/{order_id}";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new Dictionary<String, String>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
@ -347,7 +347,7 @@ namespace IO.Swagger.Api
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (orderId != null) localVarPathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
@ -393,7 +393,7 @@ namespace IO.Swagger.Api
|
||||
if (orderId == null)
|
||||
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder");
|
||||
|
||||
var localVarPath = "/store/order/{orderId}";
|
||||
var localVarPath = "/store/order/{order_id}";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new Dictionary<String, String>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
@ -415,7 +415,7 @@ namespace IO.Swagger.Api
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (orderId != null) localVarPathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
@ -595,7 +595,7 @@ namespace IO.Swagger.Api
|
||||
if (orderId == null)
|
||||
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->GetOrderById");
|
||||
|
||||
var localVarPath = "/store/order/{orderId}";
|
||||
var localVarPath = "/store/order/{order_id}";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new Dictionary<String, String>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
@ -617,7 +617,7 @@ namespace IO.Swagger.Api
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (orderId != null) localVarPathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
@ -664,7 +664,7 @@ namespace IO.Swagger.Api
|
||||
if (orderId == null)
|
||||
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->GetOrderById");
|
||||
|
||||
var localVarPath = "/store/order/{orderId}";
|
||||
var localVarPath = "/store/order/{order_id}";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new Dictionary<String, String>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
@ -686,7 +686,7 @@ namespace IO.Swagger.Api
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (orderId != null) localVarPathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
|
@ -33,9 +33,9 @@ Class | Method | HTTP request | Description
|
||||
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **Put** /pet | Update an existing pet
|
||||
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **Post** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **Post** /pet/{petId}/uploadImage | uploads an image
|
||||
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **Delete** /store/order/{orderId} | Delete purchase order by ID
|
||||
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **Delete** /store/order/{order_id} | Delete purchase order by ID
|
||||
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **Get** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **Get** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **Get** /store/order/{order_id} | Find purchase order by ID
|
||||
*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **Post** /store/order | Place an order for a pet
|
||||
*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **Post** /user | Create user
|
||||
*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **Post** /user/createWithArray | Creates list of users with given input array
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**DeleteOrder**](StoreApi.md#DeleteOrder) | **Delete** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**DeleteOrder**](StoreApi.md#DeleteOrder) | **Delete** /store/order/{order_id} | Delete purchase order by ID
|
||||
[**GetInventory**](StoreApi.md#GetInventory) | **Get** /store/inventory | Returns pet inventories by status
|
||||
[**GetOrderById**](StoreApi.md#GetOrderById) | **Get** /store/order/{orderId} | Find purchase order by ID
|
||||
[**GetOrderById**](StoreApi.md#GetOrderById) | **Get** /store/order/{order_id} | Find purchase order by ID
|
||||
[**PlaceOrder**](StoreApi.md#PlaceOrder) | **Post** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -48,8 +48,8 @@ func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) {
|
||||
|
||||
var localVarHttpMethod = strings.ToUpper("Delete")
|
||||
// create path and map variables
|
||||
localVarPath := a.Configuration.BasePath + "/store/order/{orderId}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1)
|
||||
localVarPath := a.Configuration.BasePath + "/store/order/{order_id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@ -170,8 +170,8 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) {
|
||||
|
||||
var localVarHttpMethod = strings.ToUpper("Get")
|
||||
// create path and map variables
|
||||
localVarPath := a.Configuration.BasePath + "/store/order/{orderId}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1)
|
||||
localVarPath := a.Configuration.BasePath + "/store/order/{order_id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
@ -230,6 +230,18 @@
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>mockwebserver</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>1.7.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<java.version>1.7</java.version>
|
||||
|
@ -0,0 +1,86 @@
|
||||
package io.swagger.client;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Utilities to support Swagger encoding formats in Feign.
|
||||
*/
|
||||
public final class EncodingUtils {
|
||||
|
||||
/**
|
||||
* Private constructor. Do not construct this class.
|
||||
*/
|
||||
private EncodingUtils() {}
|
||||
|
||||
/**
|
||||
* <p>Encodes a collection of query parameters according to the Swagger
|
||||
* collection format.</p>
|
||||
*
|
||||
* <p>Of the various collection formats defined by Swagger ("csv", "tsv",
|
||||
* etc), Feign only natively supports "multi". This utility generates the
|
||||
* other format types so it will be properly processed by Feign.</p>
|
||||
*
|
||||
* <p>Note, as part of reformatting, it URL encodes the parameters as
|
||||
* well.</p>
|
||||
* @param parameters The collection object to be formatted. This object will
|
||||
* not be changed.
|
||||
* @param collectionFormat The Swagger collection format (eg, "csv", "tsv",
|
||||
* "pipes"). See the
|
||||
* <a href="http://swagger.io/specification/#parameter-object-44">
|
||||
* Swagger Spec</a> for more details.
|
||||
* @return An object that will be correctly formatted by Feign.
|
||||
*/
|
||||
public static Object encodeCollection(Collection<?> parameters,
|
||||
String collectionFormat) {
|
||||
if (parameters == null) {
|
||||
return parameters;
|
||||
}
|
||||
List<String> stringValues = new ArrayList<>(parameters.size());
|
||||
for (Object parameter : parameters) {
|
||||
// ignore null values (same behavior as Feign)
|
||||
if (parameter != null) {
|
||||
stringValues.add(encode(parameter));
|
||||
}
|
||||
}
|
||||
// Feign natively handles single-element lists and the "multi" format.
|
||||
if (stringValues.size() < 2 || "multi".equals(collectionFormat)) {
|
||||
return stringValues;
|
||||
}
|
||||
// Otherwise return a formatted String
|
||||
String[] stringArray = stringValues.toArray(new String[0]);
|
||||
switch (collectionFormat) {
|
||||
case "csv":
|
||||
default:
|
||||
return StringUtil.join(stringArray, ",");
|
||||
case "ssv":
|
||||
return StringUtil.join(stringArray, " ");
|
||||
case "tsv":
|
||||
return StringUtil.join(stringArray, "\t");
|
||||
case "pipes":
|
||||
return StringUtil.join(stringArray, "|");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* URL encode a single query parameter.
|
||||
* @param parameter The query parameter to encode. This object will not be
|
||||
* changed.
|
||||
* @return The URL encoded string representation of the parameter. If the
|
||||
* parameter is null, returns null.
|
||||
*/
|
||||
public static String encode(Object parameter) {
|
||||
if (parameter == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return URLEncoder.encode(parameter.toString(), "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Should never happen, UTF-8 is always supported
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.client.ApiClient;
|
||||
import io.swagger.client.EncodingUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.client.model.Client;
|
||||
@ -106,7 +107,7 @@ public interface FakeApi extends ApiClient.Api {
|
||||
|
||||
"enum_header_string: {enumHeaderString}"
|
||||
})
|
||||
void testEnumParameters(@Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString, @Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryDouble") Double enumQueryDouble, @QueryMap Map<String, Object> queryParams);
|
||||
void testEnumParameters(@Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString, @Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryDouble") Double enumQueryDouble, @QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||
|
||||
/**
|
||||
* A convenience class for generating query parameters for the
|
||||
@ -114,15 +115,15 @@ public interface FakeApi extends ApiClient.Api {
|
||||
*/
|
||||
public static class TestEnumParametersQueryParams extends HashMap<String, Object> {
|
||||
public TestEnumParametersQueryParams enumQueryStringArray(final List<String> value) {
|
||||
put("enum_query_string_array", value);
|
||||
put("enum_query_string_array", EncodingUtils.encodeCollection(value, "csv"));
|
||||
return this;
|
||||
}
|
||||
public TestEnumParametersQueryParams enumQueryString(final String value) {
|
||||
put("enum_query_string", value);
|
||||
put("enum_query_string", EncodingUtils.encode(value));
|
||||
return this;
|
||||
}
|
||||
public TestEnumParametersQueryParams enumQueryInteger(final Integer value) {
|
||||
put("enum_query_integer", value);
|
||||
put("enum_query_integer", EncodingUtils.encode(value));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.client.ApiClient;
|
||||
import io.swagger.client.EncodingUtils;
|
||||
|
||||
import java.io.File;
|
||||
import io.swagger.client.model.ModelApiResponse;
|
||||
@ -75,7 +76,7 @@ public interface PetApi extends ApiClient.Api {
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
List<Pet> findPetsByStatus(@QueryMap Map<String, Object> queryParams);
|
||||
List<Pet> findPetsByStatus(@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||
|
||||
/**
|
||||
* A convenience class for generating query parameters for the
|
||||
@ -83,7 +84,7 @@ public interface PetApi extends ApiClient.Api {
|
||||
*/
|
||||
public static class FindPetsByStatusQueryParams extends HashMap<String, Object> {
|
||||
public FindPetsByStatusQueryParams status(final List<String> value) {
|
||||
put("status", value);
|
||||
put("status", EncodingUtils.encodeCollection(value, "csv"));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -121,7 +122,7 @@ public interface PetApi extends ApiClient.Api {
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
List<Pet> findPetsByTags(@QueryMap Map<String, Object> queryParams);
|
||||
List<Pet> findPetsByTags(@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||
|
||||
/**
|
||||
* A convenience class for generating query parameters for the
|
||||
@ -129,7 +130,7 @@ public interface PetApi extends ApiClient.Api {
|
||||
*/
|
||||
public static class FindPetsByTagsQueryParams extends HashMap<String, Object> {
|
||||
public FindPetsByTagsQueryParams tags(final List<String> value) {
|
||||
put("tags", value);
|
||||
put("tags", EncodingUtils.encodeCollection(value, "csv"));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.client.ApiClient;
|
||||
import io.swagger.client.EncodingUtils;
|
||||
|
||||
import io.swagger.client.model.Order;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.client.ApiClient;
|
||||
import io.swagger.client.EncodingUtils;
|
||||
|
||||
import io.swagger.client.model.User;
|
||||
|
||||
@ -110,7 +111,7 @@ public interface UserApi extends ApiClient.Api {
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
String loginUser(@QueryMap Map<String, Object> queryParams);
|
||||
String loginUser(@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||
|
||||
/**
|
||||
* A convenience class for generating query parameters for the
|
||||
@ -118,11 +119,11 @@ public interface UserApi extends ApiClient.Api {
|
||||
*/
|
||||
public static class LoginUserQueryParams extends HashMap<String, Object> {
|
||||
public LoginUserQueryParams username(final String value) {
|
||||
put("username", value);
|
||||
put("username", EncodingUtils.encode(value));
|
||||
return this;
|
||||
}
|
||||
public LoginUserQueryParams password(final String value) {
|
||||
put("password", value);
|
||||
put("password", EncodingUtils.encode(value));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -13,17 +13,25 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import okhttp3.mockwebserver.MockResponse;
|
||||
import okhttp3.mockwebserver.MockWebServer;
|
||||
import okhttp3.mockwebserver.RecordedRequest;
|
||||
import org.junit.*;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class PetApiTest {
|
||||
private ApiClient apiClient;
|
||||
private PetApi api;
|
||||
ApiClient apiClient;
|
||||
PetApi api;
|
||||
MockWebServer localServer;
|
||||
ApiClient localClient;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
apiClient = new ApiClient();
|
||||
api = apiClient.buildClient(PetApi.class);
|
||||
localServer = new MockWebServer();
|
||||
localClient = new ApiClient();
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -211,6 +219,20 @@ public class PetApiTest {
|
||||
assertTrue(pet1.hashCode() == pet1.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCSVDelimitedArray() throws Exception {
|
||||
localServer.enqueue(new MockResponse().setBody("[{\"id\":5,\"name\":\"rocky\"}]"));
|
||||
localServer.start();
|
||||
PetApi api = localClient.setBasePath(localServer.url("/").toString()).buildClient(PetApi.class);
|
||||
PetApi.FindPetsByTagsQueryParams queryParams = new PetApi.FindPetsByTagsQueryParams()
|
||||
.tags(Arrays.asList("friendly","energetic"));
|
||||
List<Pet> pets = api.findPetsByTags(queryParams);
|
||||
assertNotNull(pets);
|
||||
RecordedRequest request = localServer.takeRequest();
|
||||
assertThat(request.getPath()).contains("tags=friendly,energetic");
|
||||
localServer.shutdown();
|
||||
}
|
||||
|
||||
private Pet createRandomPet() {
|
||||
Pet pet = new Pet();
|
||||
pet.setId(TestUtils.nextId());
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -118,7 +118,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
|
@ -63,8 +63,8 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
@ -140,8 +140,8 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -117,7 +117,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
|
@ -49,8 +49,8 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
@ -126,8 +126,8 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -117,7 +117,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
|
@ -49,8 +49,8 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
@ -126,8 +126,8 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -117,7 +117,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
|
@ -49,8 +49,8 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
@ -126,8 +126,8 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -516,12 +516,13 @@ public class ApiClient {
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
*
|
||||
* application/vnd.company+json
|
||||
* @param mime MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public boolean isJsonMime(String mime) {
|
||||
return mime != null && mime.matches("(?i)application\\/json(;.*)?");
|
||||
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
|
||||
return mime != null && mime.matches(jsonMime);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,8 +66,8 @@ public class StoreApi {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
|
||||
@ -304,8 +304,8 @@ public class StoreApi {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -66,8 +66,8 @@ public class StoreApi {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
|
||||
@ -304,8 +304,8 @@ public class StoreApi {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
|
||||
|
@ -117,7 +117,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
|
@ -22,9 +22,9 @@ public interface StoreApi {
|
||||
* @return Void
|
||||
*/
|
||||
|
||||
@DELETE("/store/order/{orderId}")
|
||||
@DELETE("/store/order/{order_id}")
|
||||
Void deleteOrder(
|
||||
@retrofit.http.Path("orderId") String orderId
|
||||
@retrofit.http.Path("order_id") String orderId
|
||||
);
|
||||
|
||||
/**
|
||||
@ -34,9 +34,9 @@ public interface StoreApi {
|
||||
* @param cb callback method
|
||||
*/
|
||||
|
||||
@DELETE("/store/order/{orderId}")
|
||||
@DELETE("/store/order/{order_id}")
|
||||
void deleteOrder(
|
||||
@retrofit.http.Path("orderId") String orderId, Callback<Void> cb
|
||||
@retrofit.http.Path("order_id") String orderId, Callback<Void> cb
|
||||
);
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
@ -67,9 +67,9 @@ public interface StoreApi {
|
||||
* @return Order
|
||||
*/
|
||||
|
||||
@GET("/store/order/{orderId}")
|
||||
@GET("/store/order/{order_id}")
|
||||
Order getOrderById(
|
||||
@retrofit.http.Path("orderId") Long orderId
|
||||
@retrofit.http.Path("order_id") Long orderId
|
||||
);
|
||||
|
||||
/**
|
||||
@ -79,9 +79,9 @@ public interface StoreApi {
|
||||
* @param cb callback method
|
||||
*/
|
||||
|
||||
@GET("/store/order/{orderId}")
|
||||
@GET("/store/order/{order_id}")
|
||||
void getOrderById(
|
||||
@retrofit.http.Path("orderId") Long orderId, Callback<Order> cb
|
||||
@retrofit.http.Path("order_id") Long orderId, Callback<Order> cb
|
||||
);
|
||||
/**
|
||||
* Place an order for a pet
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** store/order/{orderId} | Delete purchase order by ID
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** store/order/{order_id} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** store/order/{orderId} | Find purchase order by ID
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** store/order/{order_id} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -26,9 +26,9 @@ public interface StoreApi {
|
||||
* @param orderId ID of the order that needs to be deleted (required)
|
||||
* @return Call<Void>
|
||||
*/
|
||||
@DELETE("store/order/{orderId}")
|
||||
@DELETE("store/order/{order_id}")
|
||||
F.Promise<Response<Void>> deleteOrder(
|
||||
@retrofit2.http.Path("orderId") String orderId
|
||||
@retrofit2.http.Path("order_id") String orderId
|
||||
);
|
||||
|
||||
/**
|
||||
@ -46,9 +46,9 @@ public interface StoreApi {
|
||||
* @param orderId ID of pet that needs to be fetched (required)
|
||||
* @return Call<Order>
|
||||
*/
|
||||
@GET("store/order/{orderId}")
|
||||
@GET("store/order/{order_id}")
|
||||
F.Promise<Response<Order>> getOrderById(
|
||||
@retrofit2.http.Path("orderId") Long orderId
|
||||
@retrofit2.http.Path("order_id") Long orderId
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** store/order/{orderId} | Delete purchase order by ID
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** store/order/{order_id} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** store/order/{orderId} | Find purchase order by ID
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** store/order/{order_id} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -24,9 +24,9 @@ public interface StoreApi {
|
||||
* @param orderId ID of the order that needs to be deleted (required)
|
||||
* @return Call<Void>
|
||||
*/
|
||||
@DELETE("store/order/{orderId}")
|
||||
@DELETE("store/order/{order_id}")
|
||||
Call<Void> deleteOrder(
|
||||
@retrofit2.http.Path("orderId") String orderId
|
||||
@retrofit2.http.Path("order_id") String orderId
|
||||
);
|
||||
|
||||
/**
|
||||
@ -44,9 +44,9 @@ public interface StoreApi {
|
||||
* @param orderId ID of pet that needs to be fetched (required)
|
||||
* @return Call<Order>
|
||||
*/
|
||||
@GET("store/order/{orderId}")
|
||||
@GET("store/order/{order_id}")
|
||||
Call<Order> getOrderById(
|
||||
@retrofit2.http.Path("orderId") Long orderId
|
||||
@retrofit2.http.Path("order_id") Long orderId
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** store/order/{orderId} | Delete purchase order by ID
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** store/order/{order_id} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** store/order/{orderId} | Find purchase order by ID
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** store/order/{order_id} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -24,9 +24,9 @@ public interface StoreApi {
|
||||
* @param orderId ID of the order that needs to be deleted (required)
|
||||
* @return Call<Void>
|
||||
*/
|
||||
@DELETE("store/order/{orderId}")
|
||||
@DELETE("store/order/{order_id}")
|
||||
Observable<Void> deleteOrder(
|
||||
@retrofit2.http.Path("orderId") String orderId
|
||||
@retrofit2.http.Path("order_id") String orderId
|
||||
);
|
||||
|
||||
/**
|
||||
@ -44,9 +44,9 @@ public interface StoreApi {
|
||||
* @param orderId ID of pet that needs to be fetched (required)
|
||||
* @return Call<Order>
|
||||
*/
|
||||
@GET("store/order/{orderId}")
|
||||
@GET("store/order/{order_id}")
|
||||
Observable<Order> getOrderById(
|
||||
@retrofit2.http.Path("orderId") Long orderId
|
||||
@retrofit2.http.Path("order_id") Long orderId
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** store/order/{orderId} | Delete purchase order by ID
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** store/order/{order_id} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** store/order/{orderId} | Find purchase order by ID
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** store/order/{order_id} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -24,9 +24,9 @@ public interface StoreApi {
|
||||
* @param orderId ID of the order that needs to be deleted (required)
|
||||
* @return Call<Void>
|
||||
*/
|
||||
@DELETE("store/order/{orderId}")
|
||||
@DELETE("store/order/{order_id}")
|
||||
Observable<Void> deleteOrder(
|
||||
@retrofit2.http.Path("orderId") String orderId
|
||||
@retrofit2.http.Path("order_id") String orderId
|
||||
);
|
||||
|
||||
/**
|
||||
@ -44,9 +44,9 @@ public interface StoreApi {
|
||||
* @param orderId ID of pet that needs to be fetched (required)
|
||||
* @return Call<Order>
|
||||
*/
|
||||
@GET("store/order/{orderId}")
|
||||
@GET("store/order/{order_id}")
|
||||
Observable<Order> getOrderById(
|
||||
@retrofit2.http.Path("orderId") Long orderId
|
||||
@retrofit2.http.Path("order_id") Long orderId
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -83,9 +83,9 @@ Class | Method | HTTP request | Description
|
||||
*SwaggerPetstore.PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
*SwaggerPetstore.PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*SwaggerPetstore.PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*SwaggerPetstore.StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
*SwaggerPetstore.StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
*SwaggerPetstore.StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*SwaggerPetstore.StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*SwaggerPetstore.StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
*SwaggerPetstore.StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
*SwaggerPetstore.UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
|
||||
*SwaggerPetstore.UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user