mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 02:55:19 +00:00
Merge remote-tracking branch 'origin/master' into 2.3.0
This commit is contained in:
commit
255bc02b83
10
README.md
10
README.md
@ -792,6 +792,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
|
||||
- [Plexxi](http://www.plexxi.com)
|
||||
- [Pixoneye](http://www.pixoneye.com/)
|
||||
- [PostAffiliatePro](https://www.postaffiliatepro.com/)
|
||||
- [QAdept](http://qadept.com/)
|
||||
- [QuantiModo](https://quantimo.do/)
|
||||
- [Rapid7](https://rapid7.com/)
|
||||
- [Reload! A/S](https://reload.dk/)
|
||||
@ -913,6 +914,15 @@ Here are the requirements to become a core team member:
|
||||
|
||||
To become a Template Creator, simply submit a PR for new API client (e.g. Rust, Elixir) or server stub (e.g. Ruby Grape) generator.
|
||||
|
||||
## License information on Generated Code
|
||||
|
||||
The Swagger Codegen project is intended as a benefit for users of the Swagger / Open API Specification. The project itself has the [License](#license) as specified. In addition, please understand the following points:
|
||||
|
||||
* The templates included with this project are subject to the [License](#license).
|
||||
* Generated code is intentionally _not_ subject to the parent project license
|
||||
|
||||
When code is generated from this project, it shall be considered **AS IS** and owned by the user of the software. There are no warranties--expressed or implied--for generated code. You can do what you wish with it, and once generated, the code is your responsibility and subject to the licensing terms that you deem appropriate.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
|
@ -310,7 +310,10 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
}
|
||||
|
||||
if (addCompileSourceRoot) {
|
||||
String sourceJavaFolder = output.toString() + "/" + configOptions.get(CodegenConstants.SOURCE_FOLDER);
|
||||
final Object sourceFolderObject = configOptions.get(CodegenConstants.SOURCE_FOLDER);
|
||||
final String sourceFolder = sourceFolderObject == null ? "src/main/java" : sourceFolderObject.toString();
|
||||
|
||||
String sourceJavaFolder = output.toString() + "/" + sourceFolder;
|
||||
project.addCompileSourceRoot(sourceJavaFolder);
|
||||
}
|
||||
}
|
||||
|
@ -1892,7 +1892,11 @@ public class DefaultCodegen {
|
||||
for (String key : consumes) {
|
||||
Map<String, String> mediaType = new HashMap<String, String>();
|
||||
// escape quotation to avoid code injection
|
||||
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
|
||||
if ("*/*".equals(key)) { // "*/*" is a special case, do nothing
|
||||
mediaType.put("mediaType", key);
|
||||
} else {
|
||||
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
|
||||
}
|
||||
count += 1;
|
||||
if (count < consumes.size()) {
|
||||
mediaType.put("hasMore", "true");
|
||||
@ -1926,7 +1930,11 @@ public class DefaultCodegen {
|
||||
for (String key : produces) {
|
||||
Map<String, String> mediaType = new HashMap<String, String>();
|
||||
// escape quotation to avoid code injection
|
||||
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
|
||||
if ("*/*".equals(key)) { // "*/*" is a special case, do nothing
|
||||
mediaType.put("mediaType", key);
|
||||
} else {
|
||||
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
|
||||
}
|
||||
count += 1;
|
||||
if (count < produces.size()) {
|
||||
mediaType.put("hasMore", "true");
|
||||
|
@ -141,7 +141,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
config.additionalProperties().put("generatedDate", DateTime.now().toString());
|
||||
config.additionalProperties().put("generatorClass", config.getClass().toString());
|
||||
config.additionalProperties().put("inputSpec", config.getInputSpec());
|
||||
|
||||
|
||||
if (swagger.getInfo() != null) {
|
||||
Info info = swagger.getInfo();
|
||||
if (info.getTitle() != null) {
|
||||
@ -405,6 +405,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
operation.put("classname", config.toApiName(tag));
|
||||
operation.put("classVarName", config.toApiVarName(tag));
|
||||
operation.put("importPath", config.toApiImport(tag));
|
||||
operation.put("classFilename", config.toApiFilename(tag));
|
||||
|
||||
if(!config.vendorExtensions().isEmpty()) {
|
||||
operation.put("vendorExtensions", config.vendorExtensions());
|
||||
|
@ -291,7 +291,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
typeMapping.put("DateTime", "OffsetDateTime");
|
||||
importMapping.put("OffsetDateTime", "java.time.OffsetDateTime");
|
||||
}
|
||||
} else {
|
||||
} else if (dateLibrary.equals("legacy")) {
|
||||
additionalProperties.put("legacyDates", "true");
|
||||
}
|
||||
}
|
||||
|
@ -139,8 +139,11 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
} else if ( operation.returnType.startsWith("List") ) {
|
||||
String rt = operation.returnType;
|
||||
int end = rt.lastIndexOf(">");
|
||||
|
@ -10,6 +10,8 @@ public class AspNet5ServerCodegen extends AspNetCoreServerCodegen {
|
||||
|
||||
public AspNet5ServerCodegen() {
|
||||
super();
|
||||
|
||||
embeddedTemplateDir = templateDir = "aspnetcore";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,8 +136,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen implements BeanValida
|
||||
}
|
||||
|
||||
if ("feign".equals(getLibrary())) {
|
||||
supportingFiles.add(new SupportingFile("FormAwareEncoder.mustache", invokerFolder, "FormAwareEncoder.java"));
|
||||
additionalProperties.put("jackson", "true");
|
||||
supportingFiles.add(new SupportingFile("ParamExpander.mustache", invokerFolder, "ParamExpander.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"));
|
||||
|
@ -24,6 +24,7 @@ import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
|
||||
|
||||
import feign.Feign;
|
||||
import feign.RequestInterceptor;
|
||||
import feign.form.FormEncoder;
|
||||
import feign.jackson.JacksonDecoder;
|
||||
import feign.jackson.JacksonEncoder;
|
||||
import feign.slf4j.Slf4jLogger;
|
||||
@ -43,7 +44,7 @@ public class ApiClient {
|
||||
objectMapper = createObjectMapper();
|
||||
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
||||
feignBuilder = Feign.builder()
|
||||
.encoder(new FormAwareEncoder(new JacksonEncoder(objectMapper)))
|
||||
.encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
|
||||
.decoder(new JacksonDecoder(objectMapper))
|
||||
.logger(new Slf4jLogger());
|
||||
}
|
||||
|
@ -1,192 +0,0 @@
|
||||
package {{invokerPackage}};
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.URLEncoder;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
|
||||
import java.text.DateFormat;
|
||||
|
||||
import feign.codec.EncodeException;
|
||||
import feign.codec.Encoder;
|
||||
import feign.RequestTemplate;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
public class FormAwareEncoder implements Encoder {
|
||||
public static final String UTF_8 = "utf-8";
|
||||
private static final String LINE_FEED = "\r\n";
|
||||
private static final String TWO_DASH = "--";
|
||||
private static final String BOUNDARY = "----------------314159265358979323846";
|
||||
|
||||
private byte[] lineFeedBytes;
|
||||
private byte[] boundaryBytes;
|
||||
private byte[] twoDashBytes;
|
||||
private byte[] atBytes;
|
||||
private byte[] eqBytes;
|
||||
|
||||
private final Encoder delegate;
|
||||
private final DateFormat dateFormat;
|
||||
|
||||
public FormAwareEncoder(Encoder delegate) {
|
||||
this.delegate = delegate;
|
||||
this.dateFormat = new RFC3339DateFormat();;
|
||||
|
||||
try {
|
||||
this.lineFeedBytes = LINE_FEED.getBytes(UTF_8);
|
||||
this.boundaryBytes = BOUNDARY.getBytes(UTF_8);
|
||||
this.twoDashBytes = TWO_DASH.getBytes(UTF_8);
|
||||
this.atBytes = "&".getBytes(UTF_8);
|
||||
this.eqBytes = "=".getBytes(UTF_8);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void encode(Object object, Type bodyType, RequestTemplate template) throws EncodeException {
|
||||
if (object instanceof Map) {
|
||||
try {
|
||||
encodeFormParams(template, (Map<String, Object>) object);
|
||||
} catch (IOException e) {
|
||||
throw new EncodeException("Failed to create request", e);
|
||||
}
|
||||
} else {
|
||||
delegate.encode(object, bodyType, template);
|
||||
}
|
||||
}
|
||||
|
||||
private void encodeFormParams(RequestTemplate template, Map<String, Object> formParams) throws IOException {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
boolean isMultiPart = isMultiPart(formParams);
|
||||
boolean isFirstField = true;
|
||||
for (Map.Entry<String, Object> param : formParams.entrySet()) {
|
||||
String keyStr = param.getKey();
|
||||
if (param.getValue() instanceof File) {
|
||||
addFilePart(baos, keyStr, (File) param.getValue());
|
||||
} else {
|
||||
String valueStr = parameterToString(param.getValue());
|
||||
if (isMultiPart) {
|
||||
addMultiPartFormField(baos, keyStr, valueStr);
|
||||
} else {
|
||||
addEncodedFormField(baos, keyStr, valueStr, isFirstField);
|
||||
isFirstField = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isMultiPart) {
|
||||
baos.write(lineFeedBytes);
|
||||
baos.write(twoDashBytes);
|
||||
baos.write(boundaryBytes);
|
||||
baos.write(twoDashBytes);
|
||||
baos.write(lineFeedBytes);
|
||||
}
|
||||
|
||||
String contentType = isMultiPart ? "multipart/form-data; boundary=" + BOUNDARY : "application/x-www-form-urlencoded";
|
||||
template.header("Content-type");
|
||||
template.header("Content-type", contentType);
|
||||
template.header("MIME-Version", "1.0");
|
||||
template.body(baos.toByteArray(), Charset.forName(UTF_8));
|
||||
}
|
||||
|
||||
/*
|
||||
* Currently only supports text files
|
||||
*/
|
||||
private void addFilePart(ByteArrayOutputStream baos, String fieldName, File uploadFile) throws IOException {
|
||||
String fileName = uploadFile.getName();
|
||||
baos.write(twoDashBytes);
|
||||
baos.write(boundaryBytes);
|
||||
baos.write(lineFeedBytes);
|
||||
|
||||
String contentDisposition = "Content-Disposition: form-data; name=\"" + fieldName
|
||||
+ "\"; filename=\"" + fileName + "\"";
|
||||
baos.write(contentDisposition.getBytes(UTF_8));
|
||||
baos.write(lineFeedBytes);
|
||||
String contentType = "Content-Type: " + URLConnection.guessContentTypeFromName(fileName);
|
||||
baos.write(contentType.getBytes(UTF_8));
|
||||
baos.write(lineFeedBytes);
|
||||
baos.write(lineFeedBytes);
|
||||
|
||||
BufferedReader reader = new BufferedReader(new FileReader(uploadFile));
|
||||
InputStream input = new FileInputStream(uploadFile);
|
||||
byte[] bytes = new byte[4096];
|
||||
int len = bytes.length;
|
||||
while ((len = input.read(bytes)) != -1) {
|
||||
baos.write(bytes, 0, len);
|
||||
baos.write(lineFeedBytes);
|
||||
}
|
||||
|
||||
baos.write(lineFeedBytes);
|
||||
}
|
||||
|
||||
private void addEncodedFormField(ByteArrayOutputStream baos, String name, String value, boolean isFirstField) throws IOException {
|
||||
if (!isFirstField) {
|
||||
baos.write(atBytes);
|
||||
}
|
||||
|
||||
String encodedName = URLEncoder.encode(name, UTF_8);
|
||||
String encodedValue = URLEncoder.encode(value, UTF_8);
|
||||
baos.write(encodedName.getBytes(UTF_8));
|
||||
baos.write("=".getBytes(UTF_8));
|
||||
baos.write(encodedValue.getBytes(UTF_8));
|
||||
}
|
||||
|
||||
private void addMultiPartFormField(ByteArrayOutputStream baos, String name, String value) throws IOException {
|
||||
baos.write(twoDashBytes);
|
||||
baos.write(boundaryBytes);
|
||||
baos.write(lineFeedBytes);
|
||||
|
||||
String contentDisposition = "Content-Disposition: form-data; name=\"" + name + "\"";
|
||||
String contentType = "Content-Type: text/plain; charset=utf-8";
|
||||
|
||||
baos.write(contentDisposition.getBytes(UTF_8));
|
||||
baos.write(lineFeedBytes);
|
||||
baos.write(contentType.getBytes(UTF_8));
|
||||
baos.write(lineFeedBytes);
|
||||
baos.write(lineFeedBytes);
|
||||
baos.write(value.getBytes(UTF_8));
|
||||
baos.write(lineFeedBytes);
|
||||
}
|
||||
|
||||
private boolean isMultiPart(Map<String, Object> formParams) {
|
||||
boolean isMultiPart = false;
|
||||
for (Map.Entry<String, Object> entry : formParams.entrySet()) {
|
||||
if (entry.getValue() instanceof File) {
|
||||
isMultiPart = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isMultiPart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the given parameter object into string.
|
||||
*/
|
||||
public String parameterToString(Object param) {
|
||||
if (param == null) {
|
||||
return "";
|
||||
} else if (param instanceof Date) {
|
||||
return formatDate((Date) param);
|
||||
} else if (param instanceof Collection) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
for(Object o : (Collection)param) {
|
||||
if(b.length() > 0) {
|
||||
b.append(",");
|
||||
}
|
||||
b.append(String.valueOf(o));
|
||||
}
|
||||
return b.toString();
|
||||
} else {
|
||||
return String.valueOf(param);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the given Date object into string.
|
||||
*/
|
||||
public String formatDate(Date date) {
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package {{invokerPackage}};
|
||||
|
||||
import feign.Param;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Param Expander to convert {@link Date} to RFC3339
|
||||
*/
|
||||
public class ParamExpander implements Param.Expander {
|
||||
|
||||
private static final DateFormat dateformat = new RFC3339DateFormat();
|
||||
|
||||
@Override
|
||||
public String expand(Object value) {
|
||||
if (value instanceof Date) {
|
||||
return dateformat.format(value);
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
package {{package}};
|
||||
|
||||
import {{invokerPackage}}.ApiClient;
|
||||
{{#legacyDates}}
|
||||
import {{invokerPackage}}.ParamExpander;
|
||||
{{/legacyDates}}
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
@ -25,12 +28,12 @@ public interface {{classname}} extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{#hasMore}}&{{/hasMore}}{{/queryParams}}")
|
||||
@Headers({
|
||||
"Content-type: {{vendorExtensions.x-contentType}}",
|
||||
"Content-Type: {{vendorExtensions.x-contentType}}",
|
||||
"Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}}
|
||||
"{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{#hasMore}},
|
||||
{{/hasMore}}{{/headerParams}}
|
||||
})
|
||||
{{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isBodyParam}}@Param("{{paramName}}") {{/isBodyParam}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
{{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ ext {
|
||||
swagger_annotations_version = "1.5.9"
|
||||
jackson_version = "{{^threetenbp}}2.7.5{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}"
|
||||
feign_version = "8.17.0"
|
||||
feign_form_version = "2.0.2"
|
||||
junit_version = "4.12"
|
||||
oltu_version = "1.0.1"
|
||||
}
|
||||
@ -106,6 +107,7 @@ dependencies {
|
||||
compile "com.netflix.feign:feign-core:$feign_version"
|
||||
compile "com.netflix.feign:feign-jackson:$feign_version"
|
||||
compile "com.netflix.feign:feign-slf4j:$feign_version"
|
||||
compile "io.github.openfeign.form:feign-form:$feign_form_version"
|
||||
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
|
||||
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
|
||||
|
@ -13,18 +13,11 @@ lazy val root = (project in file(".")).
|
||||
"com.netflix.feign" % "feign-core" % "8.16.0" % "compile",
|
||||
"com.netflix.feign" % "feign-jackson" % "8.17.0" % "compile",
|
||||
"com.netflix.feign" % "feign-slf4j" % "8.16.0" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-core" % "{{^threetenbp}}2.7.5{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "{{^threetenbp}}2.7.5{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "{{^threetenbp}}2.7.5{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" % "compile",
|
||||
{{#joda}}
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5" % "compile",
|
||||
{{/joda}}
|
||||
{{#java8}}
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.7.5" % "compile",
|
||||
{{/java8}}
|
||||
{{#threetenbp}}
|
||||
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile",
|
||||
{{/threetenbp}}
|
||||
"io.github.openfeign.form" % "feign-form" % "2.0.2" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-core" % "2.7.5" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5" % "compile",
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}" % "2.7.5" % "compile",
|
||||
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile",
|
||||
"com.brsanthu" % "migbase64" % "2.2" % "compile",
|
||||
"junit" % "junit" % "4.12" % "test",
|
||||
|
@ -1,189 +1,195 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>{{groupId}}</groupId>
|
||||
<artifactId>{{artifactId}}</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>{{artifactId}}</name>
|
||||
<version>{{artifactVersion}}</version>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:swagger-api/swagger-mustache.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:swagger-api/swagger-codegen.git</developerConnection>
|
||||
<url>https://github.com/swagger-api/swagger-codegen</url>
|
||||
</scm>
|
||||
<prerequisites>
|
||||
<maven>2.2.0</maven>
|
||||
</prerequisites>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>{{groupId}}</groupId>
|
||||
<artifactId>{{artifactId}}</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>{{artifactId}}</name>
|
||||
<version>{{artifactVersion}}</version>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:swagger-api/swagger-mustache.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:swagger-api/swagger-codegen.git</developerConnection>
|
||||
<url>https://github.com/swagger-api/swagger-codegen</url>
|
||||
</scm>
|
||||
<prerequisites>
|
||||
<maven>2.2.0</maven>
|
||||
</prerequisites>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12</version>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12</version>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>loggerPath</name>
|
||||
<value>conf/log4j.properties</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||
<parallel>methods</parallel>
|
||||
<forkMode>pertest</forkMode>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>loggerPath</name>
|
||||
<value>conf/log4j.properties</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||
<parallel>methods</parallel>
|
||||
<forkMode>pertest</forkMode>
|
||||
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- attach test jar -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<!-- attach test jar -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add_sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/main/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add_test_sources</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>add-test-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/test/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-core-version}</version>
|
||||
</dependency>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add_sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/main/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add_test_sources</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>add-test-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/test/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-core-version}</version>
|
||||
</dependency>
|
||||
<!-- HTTP client: Netflix Feign -->
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-core</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-jackson</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-slf4j</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign.form</groupId>
|
||||
<artifactId>feign-form</artifactId>
|
||||
<version>${feign-form-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- HTTP client: Netflix Feign -->
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-core</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-jackson</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-slf4j</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<!-- JSON processing: jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{#joda}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/joda}}
|
||||
{{#java8}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/java8}}
|
||||
{{#threetenbp}}
|
||||
<dependency>
|
||||
<groupId>com.github.joschi.jackson</groupId>
|
||||
<artifactId>jackson-datatype-threetenbp</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/threetenbp}}
|
||||
<dependency>
|
||||
<groupId>org.apache.oltu.oauth2</groupId>
|
||||
<artifactId>org.apache.oltu.oauth2.client</artifactId>
|
||||
<version>${oltu-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON processing: jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{#joda}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/joda}}
|
||||
{{#java8}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/java8}}
|
||||
{{#threetenbp}}
|
||||
<dependency>
|
||||
<groupId>com.github.joschi.jackson</groupId>
|
||||
<artifactId>jackson-datatype-threetenbp</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/threetenbp}}
|
||||
<dependency>
|
||||
<groupId>org.apache.oltu.oauth2</groupId>
|
||||
<artifactId>org.apache.oltu.oauth2.client</artifactId>
|
||||
<version>${oltu-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<java.version>{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<swagger-core-version>1.5.9</swagger-core-version>
|
||||
<feign-version>8.17.0</feign-version>
|
||||
<jackson-version>{{^threetenbp}}2.7.5{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}</jackson-version>
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<java.version>{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<swagger-core-version>1.5.9</swagger-core-version>
|
||||
<feign-version>8.17.0</feign-version>
|
||||
<feign-form-version>2.0.2</feign-form-version>
|
||||
<jackson-version>2.7.5</jackson-version>
|
||||
<junit-version>4.12</junit-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<oltu-version>1.0.1</oltu-version>
|
||||
|
@ -63,12 +63,9 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
|
||||
{{/maximum}}
|
||||
* @return {{name}}
|
||||
**/
|
||||
{{#vendorExtensions.extraAnnotation}}
|
||||
{{{vendorExtensions.extraAnnotation}}}
|
||||
{{/vendorExtensions.extraAnnotation}}
|
||||
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
{{#vendorExtensions.extraAnnotation}}
|
||||
{{vendorExtensions.extraAnnotation}}
|
||||
{{{vendorExtensions.extraAnnotation}}}
|
||||
{{/vendorExtensions.extraAnnotation}}
|
||||
public {{{datatypeWithEnum}}} {{getter}}() {
|
||||
return {{name}};
|
||||
|
@ -25,7 +25,7 @@ public class {{classname}}ServiceImpl implements {{classname}} {
|
||||
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
|
||||
// TODO: Implement...
|
||||
|
||||
{{#returnType}}return null;{{/returnType}}
|
||||
{{^vendorExtensions.x-java-is-response-void}}return null;{{/vendorExtensions.x-java-is-response-void}}
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
|
@ -1,9 +1,9 @@
|
||||
@XmlType(name="{{datatypeWithEnum}}")
|
||||
@XmlEnum
|
||||
@XmlEnum({{datatype}}.class)
|
||||
public enum {{datatypeWithEnum}} {
|
||||
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}{{name}}({{datatype}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
|
||||
{{#enumVars}}@XmlEnumValue({{{value}}}) {{name}}({{datatype}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
|
||||
|
||||
@ -17,7 +17,17 @@ public enum {{datatypeWithEnum}} {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static {{datatypeWithEnum}} fromValue(String v) {
|
||||
return valueOf(v);
|
||||
for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||
if (String.valueOf(b.value).equals(v)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
{{#hasVars}} @XmlType(name = "{{classname}}", propOrder =
|
||||
|
@ -20,5 +20,14 @@
|
||||
{{/allowableValues}}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a <code>{{classname}}</code> enum value from a Javascript object name.
|
||||
* @param {Object} data The plain JavaScript object containing the name of the enum value.
|
||||
* @return {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> The enum <code>{{classname}}</code> value.
|
||||
*/
|
||||
exports.constructFromObject = function(object) {
|
||||
return exports[object];
|
||||
}
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,8 +15,8 @@ import {{package}}.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.wso2.msf4j.formparam.FormDataParam;
|
||||
import org.wso2.msf4j.formparam.FileInfo;
|
||||
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
@ -3,7 +3,8 @@ package {{package}};
|
||||
import {{package}}.*;
|
||||
import {{modelPackage}}.*;
|
||||
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.wso2.msf4j.formparam.FormDataParam;
|
||||
import org.wso2.msf4j.formparam.FileInfo;
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
|
@ -11,7 +11,8 @@ import {{package}}.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.wso2.msf4j.formparam.FormDataParam;
|
||||
import org.wso2.msf4j.formparam.FileInfo;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
@ -1,3 +1,3 @@
|
||||
{{#isFormParam}}{{#notFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#vendorExtensions.x-multipart}}@FormDataParam("{{paramName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/notFile}}{{#isFile}}
|
||||
@FormDataParam("{{paramName}}") InputStream {{paramName}}InputStream,
|
||||
@FormDataParam("{{paramName}}") FormDataContentDisposition {{paramName}}Detail{{/isFile}}{{/isFormParam}}
|
||||
@FormDataParam("{{paramName}}") FileInfo {{paramName}}Detail{{/isFile}}{{/isFormParam}}
|
||||
|
@ -66,16 +66,6 @@
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>2.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.containers</groupId>
|
||||
<artifactId>jersey-container-servlet-core</artifactId>
|
||||
<version>${jersey2-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-multipart</artifactId>
|
||||
<version>${jersey2-version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
|
@ -1 +1 @@
|
||||
{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}InputStream {{paramName}}InputStream, FormDataContentDisposition {{paramName}}Detail{{/isFile}}{{/isFormParam}}
|
||||
{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}InputStream {{paramName}}InputStream, FileInfo {{paramName}}Detail{{/isFile}}{{/isFormParam}}
|
||||
|
@ -16,7 +16,7 @@ part 'auth/api_key_auth.dart';
|
||||
part 'auth/oauth.dart';
|
||||
part 'auth/http_basic_auth.dart';
|
||||
|
||||
{{#apiInfo}}{{#apis}}part 'api/{{classVarName}}_api.dart';
|
||||
{{#apiInfo}}{{#apis}}part 'api/{{classFilename}}.dart';
|
||||
{{/apis}}{{/apiInfo}}
|
||||
{{#models}}{{#model}}part 'model/{{classFilename}}.dart';
|
||||
{{/model}}{{/models}}
|
||||
|
@ -32,7 +32,49 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
||||
|
||||
|
||||
/**
|
||||
* Updates header parameters and query parameters for authentication
|
||||
* Gets if the client is unreachable
|
||||
*
|
||||
* @return The client offline state
|
||||
*/
|
||||
+(BOOL) getOfflineState;
|
||||
|
||||
/**
|
||||
* Sets the client reachability, this may be overridden by the reachability manager if reachability changes
|
||||
*
|
||||
* @param status The client reachability status.
|
||||
*/
|
||||
+(void) setReachabilityStatus:(AFNetworkReachabilityStatus) status;
|
||||
|
||||
/**
|
||||
* Gets the client reachability
|
||||
*
|
||||
* @return The client reachability.
|
||||
*/
|
||||
+(AFNetworkReachabilityStatus) getReachabilityStatus;
|
||||
|
||||
/**
|
||||
* Gets the next request id
|
||||
*
|
||||
* @return The next executed request id.
|
||||
*/
|
||||
+(NSNumber*) nextRequestId;
|
||||
|
||||
/**
|
||||
* Generates request id and add it to the queue
|
||||
*
|
||||
* @return The next executed request id.
|
||||
*/
|
||||
+(NSNumber*) queueRequest;
|
||||
|
||||
/**
|
||||
* Removes request id from the queue
|
||||
*
|
||||
* @param requestId The request which will be removed.
|
||||
*/
|
||||
+(void) cancelRequest:(NSNumber*)requestId;
|
||||
|
||||
/**
|
||||
* Customizes the behavior when the reachability changed
|
||||
*
|
||||
* @param headers The header parameter will be udpated, passed by pointer to pointer.
|
||||
* @param querys The query parameters will be updated, passed by pointer to pointer.
|
||||
|
@ -95,7 +95,7 @@
|
||||
/**
|
||||
* Sets the prefix for API key
|
||||
*
|
||||
* @param apiKeyPrefix API key prefix.
|
||||
* @param prefix API key prefix.
|
||||
* @param identifier API key identifier.
|
||||
*/
|
||||
- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier;
|
||||
@ -135,7 +135,7 @@
|
||||
/**
|
||||
* Removes header from defaultHeaders
|
||||
*
|
||||
* @param Header name.
|
||||
* @param key Header name.
|
||||
*/
|
||||
-(void) removeDefaultHeaderForKey:(NSString*)key;
|
||||
|
||||
@ -148,7 +148,7 @@
|
||||
-(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key;
|
||||
|
||||
/**
|
||||
* @param Header key name.
|
||||
* @param key Header key name.
|
||||
*/
|
||||
-(NSString*) defaultHeaderForKey:(NSString*)key;
|
||||
|
||||
|
@ -28,7 +28,7 @@ extern NSInteger const {{classPrefix}}UnknownResponseObjectErrorCode;
|
||||
* Deserializes the given data to Objective-C object.
|
||||
*
|
||||
* @param data The data will be deserialized.
|
||||
* @param class The type of objective-c object.
|
||||
* @param className The type of objective-c object.
|
||||
* @param error The error
|
||||
*/
|
||||
- (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error;
|
||||
|
@ -43,7 +43,7 @@
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper {
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ {{#vars}}@"{{baseName}}": @"{{name}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }];
|
||||
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ {{#vars}}@"{{name}}": @"{{baseName}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,7 @@ Pod::Spec.new do |s|
|
||||
{{#useCoreData}} s.resources = '{{podName}}/**/*.{xcdatamodeld,xcdatamodel}'{{/useCoreData}}
|
||||
|
||||
s.dependency 'AFNetworking', '~> 3'
|
||||
s.dependency 'JSONModel', '~> 1.2'
|
||||
s.dependency 'JSONModel', '~> 1.4'
|
||||
s.dependency 'ISO8601', '~> 0.6'
|
||||
end
|
||||
|
||||
|
@ -462,7 +462,7 @@ class ApiClient(object):
|
||||
|
||||
content_types = list(map(lambda x: x.lower(), content_types))
|
||||
|
||||
if 'application/json' in content_types:
|
||||
if 'application/json' in content_types or '*/*' in content_types:
|
||||
return 'application/json'
|
||||
else:
|
||||
return content_types[0]
|
||||
|
@ -125,10 +125,11 @@ module {{moduleName}}
|
||||
# application/json
|
||||
# application/json; charset=UTF8
|
||||
# APPLICATION/JSON
|
||||
# */*
|
||||
# @param [String] mime MIME
|
||||
# @return [Boolean] True if the MIME is application/json
|
||||
def json_mime?(mime)
|
||||
!(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
|
||||
(mime == "*/*") || !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
|
||||
end
|
||||
|
||||
# Deserialize the response to the given return type.
|
||||
|
@ -613,9 +613,9 @@ paths:
|
||||
descriptions: To test enum parameters
|
||||
operationId: testEnumParameters
|
||||
consumes:
|
||||
- application/json
|
||||
- "*/*"
|
||||
produces:
|
||||
- application/json
|
||||
- "*/*"
|
||||
parameters:
|
||||
- name: enum_form_string_array
|
||||
type: array
|
||||
|
12
pom.xml
12
pom.xml
@ -463,6 +463,18 @@
|
||||
<module>samples/server/petstore/java-msf4/</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jaxrs-cxf-server</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env</name>
|
||||
<value>java</value>
|
||||
</property>
|
||||
</activation>
|
||||
<modules>
|
||||
<module>samples/server/petstore/jaxrs-cxf</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jaxrs-resteasy-server</id>
|
||||
<activation>
|
||||
|
@ -97,6 +97,7 @@ ext {
|
||||
swagger_annotations_version = "1.5.9"
|
||||
jackson_version = "2.6.4"
|
||||
feign_version = "8.17.0"
|
||||
feign_form_version = "2.0.2"
|
||||
junit_version = "4.12"
|
||||
oltu_version = "1.0.1"
|
||||
}
|
||||
@ -106,6 +107,10 @@ dependencies {
|
||||
compile "com.netflix.feign:feign-core:$feign_version"
|
||||
compile "com.netflix.feign:feign-jackson:$feign_version"
|
||||
compile "com.netflix.feign:feign-slf4j:$feign_version"
|
||||
compile "io.github.openfeign.form:feign-form:$feign_form_version"
|
||||
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
|
||||
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
|
||||
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_version",
|
||||
compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version"
|
||||
compile "com.brsanthu:migbase64:2.2"
|
||||
|
@ -13,7 +13,11 @@ lazy val root = (project in file(".")).
|
||||
"com.netflix.feign" % "feign-core" % "8.16.0" % "compile",
|
||||
"com.netflix.feign" % "feign-jackson" % "8.17.0" % "compile",
|
||||
"com.netflix.feign" % "feign-slf4j" % "8.16.0" % "compile",
|
||||
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile",
|
||||
"io.github.openfeign.form" % "feign-form" % "2.0.2" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-core" % "2.7.5" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5" % "compile",
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5" % "compile",
|
||||
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile",
|
||||
"com.brsanthu" % "migbase64" % "2.2" % "compile",
|
||||
"junit" % "junit" % "4.12" % "test",
|
||||
|
@ -1,158 +1,179 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-petstore-feign</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>swagger-petstore-feign</name>
|
||||
<version>1.0.0</version>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:swagger-api/swagger-mustache.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:swagger-api/swagger-codegen.git</developerConnection>
|
||||
<url>https://github.com/swagger-api/swagger-codegen</url>
|
||||
</scm>
|
||||
<prerequisites>
|
||||
<maven>2.2.0</maven>
|
||||
</prerequisites>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12</version>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>loggerPath</name>
|
||||
<value>conf/log4j.properties</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||
<parallel>methods</parallel>
|
||||
<forkMode>pertest</forkMode>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- attach test jar -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add_sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/main/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add_test_sources</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>add-test-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/test/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-petstore-feign</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>swagger-petstore-feign</name>
|
||||
<version>1.0.0</version>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:swagger-api/swagger-mustache.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:swagger-api/swagger-codegen.git</developerConnection>
|
||||
<url>https://github.com/swagger-api/swagger-codegen</url>
|
||||
</scm>
|
||||
<prerequisites>
|
||||
<maven>2.2.0</maven>
|
||||
</prerequisites>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-core-version}</version>
|
||||
</dependency>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12</version>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>loggerPath</name>
|
||||
<value>conf/log4j.properties</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||
<parallel>methods</parallel>
|
||||
<forkMode>pertest</forkMode>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- HTTP client: Netflix Feign -->
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-core</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-jackson</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-slf4j</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign.form</groupId>
|
||||
<artifactId>feign-form</artifactId>
|
||||
<version>${feign-form-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- attach test jar -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- JSON processing: jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.joschi.jackson</groupId>
|
||||
<artifactId>jackson-datatype-threetenbp</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.oltu.oauth2</groupId>
|
||||
<artifactId>org.apache.oltu.oauth2.client</artifactId>
|
||||
<version>${oltu-version}</version>
|
||||
</dependency>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add_sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/main/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add_test_sources</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>add-test-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/test/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-core-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- HTTP client: Netflix Feign -->
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-core</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-jackson</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-slf4j</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON processing: jackson -->
|
||||
<dependency>
|
||||
<groupId>com.github.joschi.jackson</groupId>
|
||||
<artifactId>jackson-datatype-threetenbp</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.oltu.oauth2</groupId>
|
||||
<artifactId>org.apache.oltu.oauth2.client</artifactId>
|
||||
<version>${oltu-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<java.version>1.7</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<swagger-core-version>1.5.9</swagger-core-version>
|
||||
<feign-version>8.17.0</feign-version>
|
||||
<jackson-version>2.6.4</jackson-version>
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<java.version>1.7</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<swagger-core-version>1.5.9</swagger-core-version>
|
||||
<feign-version>8.17.0</feign-version>
|
||||
<feign-form-version>2.0.2</feign-form-version>
|
||||
<jackson-version>2.7.5</jackson-version>
|
||||
<junit-version>4.12</junit-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<oltu-version>1.0.1</oltu-version>
|
||||
|
@ -5,9 +5,7 @@ import java.util.Map;
|
||||
|
||||
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder;
|
||||
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder;
|
||||
import org.threeten.bp.Instant;
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import org.threeten.bp.ZonedDateTime;
|
||||
import org.threeten.bp.*;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@ -16,6 +14,7 @@ import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
|
||||
|
||||
import feign.Feign;
|
||||
import feign.RequestInterceptor;
|
||||
import feign.form.FormEncoder;
|
||||
import feign.jackson.JacksonDecoder;
|
||||
import feign.jackson.JacksonEncoder;
|
||||
import feign.slf4j.Slf4jLogger;
|
||||
@ -35,7 +34,7 @@ public class ApiClient {
|
||||
objectMapper = createObjectMapper();
|
||||
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
||||
feignBuilder = Feign.builder()
|
||||
.encoder(new FormAwareEncoder(new JacksonEncoder(objectMapper)))
|
||||
.encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
|
||||
.decoder(new JacksonDecoder(objectMapper))
|
||||
.logger(new Slf4jLogger());
|
||||
}
|
||||
|
@ -1,192 +0,0 @@
|
||||
package io.swagger.client;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.URLEncoder;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
|
||||
import java.text.DateFormat;
|
||||
|
||||
import feign.codec.EncodeException;
|
||||
import feign.codec.Encoder;
|
||||
import feign.RequestTemplate;
|
||||
|
||||
|
||||
public class FormAwareEncoder implements Encoder {
|
||||
public static final String UTF_8 = "utf-8";
|
||||
private static final String LINE_FEED = "\r\n";
|
||||
private static final String TWO_DASH = "--";
|
||||
private static final String BOUNDARY = "----------------314159265358979323846";
|
||||
|
||||
private byte[] lineFeedBytes;
|
||||
private byte[] boundaryBytes;
|
||||
private byte[] twoDashBytes;
|
||||
private byte[] atBytes;
|
||||
private byte[] eqBytes;
|
||||
|
||||
private final Encoder delegate;
|
||||
private final DateFormat dateFormat;
|
||||
|
||||
public FormAwareEncoder(Encoder delegate) {
|
||||
this.delegate = delegate;
|
||||
this.dateFormat = new RFC3339DateFormat();;
|
||||
|
||||
try {
|
||||
this.lineFeedBytes = LINE_FEED.getBytes(UTF_8);
|
||||
this.boundaryBytes = BOUNDARY.getBytes(UTF_8);
|
||||
this.twoDashBytes = TWO_DASH.getBytes(UTF_8);
|
||||
this.atBytes = "&".getBytes(UTF_8);
|
||||
this.eqBytes = "=".getBytes(UTF_8);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void encode(Object object, Type bodyType, RequestTemplate template) throws EncodeException {
|
||||
if (object instanceof Map) {
|
||||
try {
|
||||
encodeFormParams(template, (Map<String, Object>) object);
|
||||
} catch (IOException e) {
|
||||
throw new EncodeException("Failed to create request", e);
|
||||
}
|
||||
} else {
|
||||
delegate.encode(object, bodyType, template);
|
||||
}
|
||||
}
|
||||
|
||||
private void encodeFormParams(RequestTemplate template, Map<String, Object> formParams) throws IOException {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
boolean isMultiPart = isMultiPart(formParams);
|
||||
boolean isFirstField = true;
|
||||
for (Map.Entry<String, Object> param : formParams.entrySet()) {
|
||||
String keyStr = param.getKey();
|
||||
if (param.getValue() instanceof File) {
|
||||
addFilePart(baos, keyStr, (File) param.getValue());
|
||||
} else {
|
||||
String valueStr = parameterToString(param.getValue());
|
||||
if (isMultiPart) {
|
||||
addMultiPartFormField(baos, keyStr, valueStr);
|
||||
} else {
|
||||
addEncodedFormField(baos, keyStr, valueStr, isFirstField);
|
||||
isFirstField = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isMultiPart) {
|
||||
baos.write(lineFeedBytes);
|
||||
baos.write(twoDashBytes);
|
||||
baos.write(boundaryBytes);
|
||||
baos.write(twoDashBytes);
|
||||
baos.write(lineFeedBytes);
|
||||
}
|
||||
|
||||
String contentType = isMultiPart ? "multipart/form-data; boundary=" + BOUNDARY : "application/x-www-form-urlencoded";
|
||||
template.header("Content-type");
|
||||
template.header("Content-type", contentType);
|
||||
template.header("MIME-Version", "1.0");
|
||||
template.body(baos.toByteArray(), Charset.forName(UTF_8));
|
||||
}
|
||||
|
||||
/*
|
||||
* Currently only supports text files
|
||||
*/
|
||||
private void addFilePart(ByteArrayOutputStream baos, String fieldName, File uploadFile) throws IOException {
|
||||
String fileName = uploadFile.getName();
|
||||
baos.write(twoDashBytes);
|
||||
baos.write(boundaryBytes);
|
||||
baos.write(lineFeedBytes);
|
||||
|
||||
String contentDisposition = "Content-Disposition: form-data; name=\"" + fieldName
|
||||
+ "\"; filename=\"" + fileName + "\"";
|
||||
baos.write(contentDisposition.getBytes(UTF_8));
|
||||
baos.write(lineFeedBytes);
|
||||
String contentType = "Content-Type: " + URLConnection.guessContentTypeFromName(fileName);
|
||||
baos.write(contentType.getBytes(UTF_8));
|
||||
baos.write(lineFeedBytes);
|
||||
baos.write(lineFeedBytes);
|
||||
|
||||
BufferedReader reader = new BufferedReader(new FileReader(uploadFile));
|
||||
InputStream input = new FileInputStream(uploadFile);
|
||||
byte[] bytes = new byte[4096];
|
||||
int len = bytes.length;
|
||||
while ((len = input.read(bytes)) != -1) {
|
||||
baos.write(bytes, 0, len);
|
||||
baos.write(lineFeedBytes);
|
||||
}
|
||||
|
||||
baos.write(lineFeedBytes);
|
||||
}
|
||||
|
||||
private void addEncodedFormField(ByteArrayOutputStream baos, String name, String value, boolean isFirstField) throws IOException {
|
||||
if (!isFirstField) {
|
||||
baos.write(atBytes);
|
||||
}
|
||||
|
||||
String encodedName = URLEncoder.encode(name, UTF_8);
|
||||
String encodedValue = URLEncoder.encode(value, UTF_8);
|
||||
baos.write(encodedName.getBytes(UTF_8));
|
||||
baos.write("=".getBytes(UTF_8));
|
||||
baos.write(encodedValue.getBytes(UTF_8));
|
||||
}
|
||||
|
||||
private void addMultiPartFormField(ByteArrayOutputStream baos, String name, String value) throws IOException {
|
||||
baos.write(twoDashBytes);
|
||||
baos.write(boundaryBytes);
|
||||
baos.write(lineFeedBytes);
|
||||
|
||||
String contentDisposition = "Content-Disposition: form-data; name=\"" + name + "\"";
|
||||
String contentType = "Content-Type: text/plain; charset=utf-8";
|
||||
|
||||
baos.write(contentDisposition.getBytes(UTF_8));
|
||||
baos.write(lineFeedBytes);
|
||||
baos.write(contentType.getBytes(UTF_8));
|
||||
baos.write(lineFeedBytes);
|
||||
baos.write(lineFeedBytes);
|
||||
baos.write(value.getBytes(UTF_8));
|
||||
baos.write(lineFeedBytes);
|
||||
}
|
||||
|
||||
private boolean isMultiPart(Map<String, Object> formParams) {
|
||||
boolean isMultiPart = false;
|
||||
for (Map.Entry<String, Object> entry : formParams.entrySet()) {
|
||||
if (entry.getValue() instanceof File) {
|
||||
isMultiPart = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isMultiPart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the given parameter object into string.
|
||||
*/
|
||||
public String parameterToString(Object param) {
|
||||
if (param == null) {
|
||||
return "";
|
||||
} else if (param instanceof Date) {
|
||||
return formatDate((Date) param);
|
||||
} else if (param instanceof Collection) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
for(Object o : (Collection)param) {
|
||||
if(b.length() > 0) {
|
||||
b.append(",");
|
||||
}
|
||||
b.append(String.valueOf(o));
|
||||
}
|
||||
return b.toString();
|
||||
} else {
|
||||
return String.valueOf(param);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the given Date object into string.
|
||||
*/
|
||||
public String formatDate(Date date) {
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package io.swagger.client;
|
||||
|
||||
import feign.Param;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Param Expander to convert {@link Date} to RFC3339
|
||||
*/
|
||||
public class ParamExpander implements Param.Expander {
|
||||
|
||||
private static final DateFormat dateformat = new RFC3339DateFormat();
|
||||
|
||||
@Override
|
||||
public String expand(Object value) {
|
||||
if (value instanceof Date) {
|
||||
return dateformat.format(value);
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
}
|
@ -3,8 +3,8 @@ package io.swagger.client.api;
|
||||
import io.swagger.client.ApiClient;
|
||||
|
||||
import io.swagger.client.model.Client;
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import org.threeten.bp.LocalDate;
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -25,7 +25,7 @@ public interface FakeApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("PATCH /fake")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
Client testClientModel(Client body);
|
||||
@ -51,7 +51,7 @@ public interface FakeApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("POST /fake")
|
||||
@Headers({
|
||||
"Content-type: application/xml; charset=utf-8",
|
||||
"Content-Type: application/xml; charset=utf-8",
|
||||
"Accept: application/xml; charset=utf-8,application/json; charset=utf-8",
|
||||
})
|
||||
void testEndpointParameters(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") byte[] binary, @Param("date") LocalDate date, @Param("dateTime") OffsetDateTime dateTime, @Param("password") String password, @Param("paramCallback") String paramCallback);
|
||||
@ -71,8 +71,8 @@ public interface FakeApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Accept: application/json",
|
||||
"Content-Type: */*",
|
||||
"Accept: */*",
|
||||
"enum_header_string_array: {enumHeaderStringArray}",
|
||||
|
||||
"enum_header_string: {enumHeaderString}"
|
||||
|
@ -1,29 +0,0 @@
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.client.ApiClient;
|
||||
|
||||
import io.swagger.client.model.Client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import feign.*;
|
||||
|
||||
|
||||
public interface FakeclassnametagsApi extends ApiClient.Api {
|
||||
|
||||
|
||||
/**
|
||||
* To test class name in snake case
|
||||
*
|
||||
* @param body client model (required)
|
||||
* @return Client
|
||||
*/
|
||||
@RequestLine("PATCH /fake_classname_test")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
Client testClassname(Client body);
|
||||
}
|
@ -3,8 +3,8 @@ package io.swagger.client.api;
|
||||
import io.swagger.client.ApiClient;
|
||||
|
||||
import io.swagger.client.model.Pet;
|
||||
import io.swagger.client.model.ModelApiResponse;
|
||||
import java.io.File;
|
||||
import io.swagger.client.model.ModelApiResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -24,7 +24,7 @@ public interface PetApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("POST /pet")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
void addPet(Pet body);
|
||||
@ -38,7 +38,7 @@ public interface PetApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("DELETE /pet/{petId}")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
"api_key: {apiKey}"
|
||||
})
|
||||
@ -52,7 +52,7 @@ public interface PetApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("GET /pet/findByStatus?status={status}")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
List<Pet> findPetsByStatus(@Param("status") List<String> status);
|
||||
@ -65,7 +65,7 @@ public interface PetApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("GET /pet/findByTags?tags={tags}")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
List<Pet> findPetsByTags(@Param("tags") List<String> tags);
|
||||
@ -78,7 +78,7 @@ public interface PetApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("GET /pet/{petId}")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
Pet getPetById(@Param("petId") Long petId);
|
||||
@ -91,7 +91,7 @@ public interface PetApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("PUT /pet")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
void updatePet(Pet body);
|
||||
@ -106,7 +106,7 @@ public interface PetApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("POST /pet/{petId}")
|
||||
@Headers({
|
||||
"Content-type: application/x-www-form-urlencoded",
|
||||
"Content-Type: application/x-www-form-urlencoded",
|
||||
"Accept: application/json",
|
||||
})
|
||||
void updatePetWithForm(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status);
|
||||
@ -121,7 +121,7 @@ public interface PetApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("POST /pet/{petId}/uploadImage")
|
||||
@Headers({
|
||||
"Content-type: multipart/form-data",
|
||||
"Content-Type: multipart/form-data",
|
||||
"Accept: application/json",
|
||||
})
|
||||
ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);
|
||||
|
@ -22,7 +22,7 @@ public interface StoreApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("DELETE /store/order/{orderId}")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
void deleteOrder(@Param("orderId") String orderId);
|
||||
@ -34,7 +34,7 @@ public interface StoreApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("GET /store/inventory")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
Map<String, Integer> getInventory();
|
||||
@ -47,7 +47,7 @@ public interface StoreApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("GET /store/order/{orderId}")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
Order getOrderById(@Param("orderId") Long orderId);
|
||||
@ -60,7 +60,7 @@ public interface StoreApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("POST /store/order")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
Order placeOrder(Order body);
|
||||
|
@ -22,7 +22,7 @@ public interface UserApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("POST /user")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
void createUser(User body);
|
||||
@ -35,7 +35,7 @@ public interface UserApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("POST /user/createWithArray")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
void createUsersWithArrayInput(List<User> body);
|
||||
@ -48,7 +48,7 @@ public interface UserApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("POST /user/createWithList")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
void createUsersWithListInput(List<User> body);
|
||||
@ -61,7 +61,7 @@ public interface UserApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("DELETE /user/{username}")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
void deleteUser(@Param("username") String username);
|
||||
@ -74,7 +74,7 @@ public interface UserApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("GET /user/{username}")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
User getUserByName(@Param("username") String username);
|
||||
@ -88,7 +88,7 @@ public interface UserApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("GET /user/login?username={username}&password={password}")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
String loginUser(@Param("username") String username, @Param("password") String password);
|
||||
@ -100,7 +100,7 @@ public interface UserApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("GET /user/logout")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
void logoutUser();
|
||||
@ -114,7 +114,7 @@ public interface UserApi extends ApiClient.Api {
|
||||
*/
|
||||
@RequestLine("PUT /user/{username}")
|
||||
@Headers({
|
||||
"Content-type: application/json",
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
void updateUser(@Param("username") String username, User body);
|
||||
|
@ -110,6 +110,7 @@ public class AdditionalPropertiesClass {
|
||||
return Objects.hash(mapProperty, mapOfMapProperty);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -97,6 +97,7 @@ public class Animal {
|
||||
return Objects.hash(className, color);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -52,6 +52,7 @@ public class AnimalFarm extends ArrayList<Animal> {
|
||||
return Objects.hash(super.hashCode());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -83,6 +83,7 @@ public class ArrayOfArrayOfNumberOnly {
|
||||
return Objects.hash(arrayArrayNumber);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -83,6 +83,7 @@ public class ArrayOfNumberOnly {
|
||||
return Objects.hash(arrayNumber);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -137,6 +137,7 @@ public class ArrayTest {
|
||||
return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -77,6 +77,7 @@ public class Cat extends Animal {
|
||||
return Objects.hash(declawed, super.hashCode());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -97,6 +97,7 @@ public class Category {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -75,6 +75,7 @@ public class Client {
|
||||
return Objects.hash(client);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -77,6 +77,7 @@ public class Dog extends Animal {
|
||||
return Objects.hash(breed, super.hashCode());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -164,6 +164,7 @@ public class EnumArrays {
|
||||
return Objects.hash(justSymbol, arrayEnum);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -209,6 +209,7 @@ public class EnumTest {
|
||||
return Objects.hash(enumString, enumInteger, enumNumber);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -353,6 +353,7 @@ public class FormatTest {
|
||||
return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -79,6 +79,7 @@ public class HasOnlyReadOnly {
|
||||
return Objects.hash(bar, foo);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -140,6 +140,7 @@ public class MapTest {
|
||||
return Objects.hash(mapMapOfString, mapOfEnumString);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -130,6 +130,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
|
||||
return Objects.hash(uuid, dateTime, map);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -98,6 +98,7 @@ public class Model200Response {
|
||||
return Objects.hash(name, propertyClass);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -119,6 +119,7 @@ public class ModelApiResponse {
|
||||
return Objects.hash(code, type, message);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -76,6 +76,7 @@ public class ModelReturn {
|
||||
return Objects.hash(_return);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -124,6 +124,7 @@ public class Name {
|
||||
return Objects.hash(name, snakeCase, property, _123Number);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -76,6 +76,7 @@ public class NumberOnly {
|
||||
return Objects.hash(justNumber);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -218,6 +218,7 @@ public class Order {
|
||||
return Objects.hash(id, petId, quantity, shipDate, status, complete);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -231,6 +231,7 @@ public class Pet {
|
||||
return Objects.hash(id, category, name, photoUrls, tags, status);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -88,6 +88,7 @@ public class ReadOnlyFirst {
|
||||
return Objects.hash(bar, baz);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -75,6 +75,7 @@ public class SpecialModelName {
|
||||
return Objects.hash(specialPropertyName);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -97,6 +97,7 @@ public class Tag {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -229,6 +229,7 @@ public class User {
|
||||
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -62,6 +62,15 @@
|
||||
*/
|
||||
"(xyz)": "(xyz)" };
|
||||
|
||||
/**
|
||||
* Returns a <code>EnumClass</code> enum value from a Javascript object name.
|
||||
* @param {Object} data The plain JavaScript object containing the name of the enum value.
|
||||
* @return {module:model/EnumClass} The enum <code>EnumClass</code> value.
|
||||
*/
|
||||
exports.constructFromObject = function(object) {
|
||||
return exports[object];
|
||||
}
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
@ -62,6 +62,15 @@
|
||||
*/
|
||||
"(xyz)": "(xyz)" };
|
||||
|
||||
/**
|
||||
* Returns a <code>EnumClass</code> enum value from a Javascript object name.
|
||||
* @param {Object} data The plain JavaScript object containing the name of the enum value.
|
||||
* @return {module:model/EnumClass} The enum <code>EnumClass</code> value.
|
||||
*/
|
||||
exports.constructFromObject = function(object) {
|
||||
return exports[object];
|
||||
}
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
@ -123,6 +123,12 @@ Class | Method | HTTP request | Description
|
||||
## Documentation For Authorization
|
||||
|
||||
|
||||
## api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
## petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
@ -132,12 +138,6 @@ Class | Method | HTTP request | Description
|
||||
- **write:pets**: modify pets in your account
|
||||
- **read:pets**: read your pets
|
||||
|
||||
## api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
|
@ -31,7 +31,7 @@ Pod::Spec.new do |s|
|
||||
s.resources = 'SwaggerClient/**/*.{xcdatamodeld,xcdatamodel}'
|
||||
|
||||
s.dependency 'AFNetworking', '~> 3'
|
||||
s.dependency 'JSONModel', '~> 1.2'
|
||||
s.dependency 'JSONModel', '~> 1.4'
|
||||
s.dependency 'ISO8601', '~> 0.6'
|
||||
end
|
||||
|
||||
|
@ -352,7 +352,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
|
||||
NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"petstore_auth", @"api_key"];
|
||||
NSArray *authSettings = @[@"api_key", @"petstore_auth"];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
|
@ -54,7 +54,49 @@ extern NSString *const SWGResponseObjectErrorKey;
|
||||
|
||||
|
||||
/**
|
||||
* Updates header parameters and query parameters for authentication
|
||||
* Gets if the client is unreachable
|
||||
*
|
||||
* @return The client offline state
|
||||
*/
|
||||
+(BOOL) getOfflineState;
|
||||
|
||||
/**
|
||||
* Sets the client reachability, this may be overridden by the reachability manager if reachability changes
|
||||
*
|
||||
* @param status The client reachability status.
|
||||
*/
|
||||
+(void) setReachabilityStatus:(AFNetworkReachabilityStatus) status;
|
||||
|
||||
/**
|
||||
* Gets the client reachability
|
||||
*
|
||||
* @return The client reachability.
|
||||
*/
|
||||
+(AFNetworkReachabilityStatus) getReachabilityStatus;
|
||||
|
||||
/**
|
||||
* Gets the next request id
|
||||
*
|
||||
* @return The next executed request id.
|
||||
*/
|
||||
+(NSNumber*) nextRequestId;
|
||||
|
||||
/**
|
||||
* Generates request id and add it to the queue
|
||||
*
|
||||
* @return The next executed request id.
|
||||
*/
|
||||
+(NSNumber*) queueRequest;
|
||||
|
||||
/**
|
||||
* Removes request id from the queue
|
||||
*
|
||||
* @param requestId The request which will be removed.
|
||||
*/
|
||||
+(void) cancelRequest:(NSNumber*)requestId;
|
||||
|
||||
/**
|
||||
* Customizes the behavior when the reachability changed
|
||||
*
|
||||
* @param headers The header parameter will be udpated, passed by pointer to pointer.
|
||||
* @param querys The query parameters will be updated, passed by pointer to pointer.
|
||||
|
@ -80,7 +80,6 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
|
||||
@"application/x-www-form-urlencoded": afhttpRequestSerializer,
|
||||
@"multipart/form-data": afhttpRequestSerializer
|
||||
};
|
||||
self.securityPolicy = [self createSecurityPolicy];
|
||||
self.responseSerializer = [AFHTTPResponseSerializer serializer];
|
||||
}
|
||||
return self;
|
||||
@ -352,25 +351,4 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
|
||||
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
|
||||
}
|
||||
|
||||
- (AFSecurityPolicy *) createSecurityPolicy {
|
||||
AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
|
||||
|
||||
id<SWGConfiguration> config = self.configuration;
|
||||
|
||||
if (config.sslCaCert) {
|
||||
NSData *certData = [NSData dataWithContentsOfFile:config.sslCaCert];
|
||||
[securityPolicy setPinnedCertificates:[NSSet setWithObject:certData]];
|
||||
}
|
||||
|
||||
if (config.verifySSL) {
|
||||
[securityPolicy setAllowInvalidCertificates:NO];
|
||||
}
|
||||
else {
|
||||
[securityPolicy setAllowInvalidCertificates:YES];
|
||||
[securityPolicy setValidatesDomainName:NO];
|
||||
}
|
||||
|
||||
return securityPolicy;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -75,18 +75,6 @@ static NSString * const kSWGAPIVersion = @"1.0.0";
|
||||
*/
|
||||
@property (readonly, nonatomic) BOOL debug;
|
||||
|
||||
/**
|
||||
* SSL/TLS verification
|
||||
* Set this to NO to skip verifying SSL certificate when calling API from https server
|
||||
*/
|
||||
@property (readonly, nonatomic) BOOL verifySSL;
|
||||
|
||||
/**
|
||||
* SSL/TLS verification
|
||||
* Set this to customize the certificate file to verify the peer
|
||||
*/
|
||||
@property (readonly, nonatomic) NSString *sslCaCert;
|
||||
|
||||
/**
|
||||
* Authentication Settings
|
||||
*/
|
||||
|
@ -117,7 +117,7 @@
|
||||
/**
|
||||
* Sets the prefix for API key
|
||||
*
|
||||
* @param apiKeyPrefix API key prefix.
|
||||
* @param prefix API key prefix.
|
||||
* @param identifier API key identifier.
|
||||
*/
|
||||
- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier;
|
||||
@ -157,7 +157,7 @@
|
||||
/**
|
||||
* Removes header from defaultHeaders
|
||||
*
|
||||
* @param Header name.
|
||||
* @param key Header name.
|
||||
*/
|
||||
-(void) removeDefaultHeaderForKey:(NSString*)key;
|
||||
|
||||
@ -170,7 +170,7 @@
|
||||
-(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key;
|
||||
|
||||
/**
|
||||
* @param Header key name.
|
||||
* @param key Header key name.
|
||||
*/
|
||||
-(NSString*) defaultHeaderForKey:(NSString*)key;
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
_username = @"";
|
||||
_password = @"";
|
||||
_accessToken= @"";
|
||||
_verifySSL = YES;
|
||||
_mutableApiKey = [NSMutableDictionary dictionary];
|
||||
_mutableApiKeyPrefix = [NSMutableDictionary dictionary];
|
||||
_mutableDefaultHeaders = [NSMutableDictionary dictionary];
|
||||
@ -104,13 +103,6 @@
|
||||
|
||||
- (NSDictionary *) authSettings {
|
||||
return @{
|
||||
@"petstore_auth":
|
||||
@{
|
||||
@"type": @"oauth",
|
||||
@"in": @"header",
|
||||
@"key": @"Authorization",
|
||||
@"value": [self getAccessToken]
|
||||
},
|
||||
@"api_key":
|
||||
@{
|
||||
@"type": @"api_key",
|
||||
@ -118,6 +110,13 @@
|
||||
@"key": @"api_key",
|
||||
@"value": [self getApiKeyWithPrefix:@"api_key"]
|
||||
},
|
||||
@"petstore_auth":
|
||||
@{
|
||||
@"type": @"oauth",
|
||||
@"in": @"header",
|
||||
@"key": @"Authorization",
|
||||
@"value": [self getAccessToken]
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ extern NSInteger const SWGUnknownResponseObjectErrorCode;
|
||||
* Deserializes the given data to Objective-C object.
|
||||
*
|
||||
* @param data The data will be deserialized.
|
||||
* @param class The type of objective-c object.
|
||||
* @param className The type of objective-c object.
|
||||
* @param error The error
|
||||
*/
|
||||
- (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper {
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
|
||||
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper {
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
|
||||
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper {
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }];
|
||||
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper {
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
|
||||
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper {
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }];
|
||||
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -214,13 +214,15 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Example" */;
|
||||
buildPhases = (
|
||||
841AD69C2F0A6609E3057F05 /* 📦 Check Pods Manifest.lock */,
|
||||
799E7E29D924C30424DFBA28 /* [CP] Check Pods Manifest.lock */,
|
||||
6003F586195388D20070C39A /* Sources */,
|
||||
6003F587195388D20070C39A /* Frameworks */,
|
||||
6003F588195388D20070C39A /* Resources */,
|
||||
429AF5C69E165ED75311B4B0 /* [CP] Copy Pods Resources */,
|
||||
183E54C09C54DAEB54B2546F /* [CP] Embed Pods Frameworks */,
|
||||
FF3F107CF27E0A54D86C49F5 /* Embed Pods Frameworks */,
|
||||
FF3F107CF27E0A54D86C49F5 /* 📦 Embed Pods Frameworks */,
|
||||
DA89ADFB80DCCB6691DED12D /* 📦 Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@ -235,13 +237,15 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Tests" */;
|
||||
buildPhases = (
|
||||
E0F523B17966072A199F040E /* 📦 Check Pods Manifest.lock */,
|
||||
7B069562A9F91E498732474F /* [CP] Check Pods Manifest.lock */,
|
||||
6003F5AA195388D20070C39A /* Sources */,
|
||||
6003F5AB195388D20070C39A /* Frameworks */,
|
||||
6003F5AC195388D20070C39A /* Resources */,
|
||||
E337D7E459CCFFDF27046FFC /* [CP] Copy Pods Resources */,
|
||||
111D7956304BD6E860AA8709 /* [CP] Embed Pods Frameworks */,
|
||||
AA7CAD658C61D6EBA222B5F8 /* Embed Pods Frameworks */,
|
||||
AA7CAD658C61D6EBA222B5F8 /* 📦 Embed Pods Frameworks */,
|
||||
E994E0232EFD15F8EE665A4D /* 📦 Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@ -380,14 +384,29 @@
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
AA7CAD658C61D6EBA222B5F8 /* Embed Pods Frameworks */ = {
|
||||
841AD69C2F0A6609E3057F05 /* 📦 Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Embed Pods Frameworks";
|
||||
name = "📦 Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
AA7CAD658C61D6EBA222B5F8 /* 📦 Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -395,6 +414,36 @@
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
DA89ADFB80DCCB6691DED12D /* 📦 Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
E0F523B17966072A199F040E /* 📦 Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
E337D7E459CCFFDF27046FFC /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -410,14 +459,29 @@
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
FF3F107CF27E0A54D86C49F5 /* Embed Pods Frameworks */ = {
|
||||
E994E0232EFD15F8EE665A4D /* 📦 Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Embed Pods Frameworks";
|
||||
name = "📦 Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
FF3F107CF27E0A54D86C49F5 /* 📦 Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -6,7 +6,6 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version:
|
||||
- Build date: 2016-09-14T16:08:31.542+02:00
|
||||
- Build package: class io.swagger.codegen.languages.ObjcClientCodegen
|
||||
|
||||
## Requirements
|
||||
@ -124,6 +123,12 @@ Class | Method | HTTP request | Description
|
||||
## Documentation For Authorization
|
||||
|
||||
|
||||
## api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
## petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
@ -133,12 +138,6 @@ Class | Method | HTTP request | Description
|
||||
- **write:pets**: modify pets in your account
|
||||
- **read:pets**: read your pets
|
||||
|
||||
## api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
|
@ -31,7 +31,7 @@ Pod::Spec.new do |s|
|
||||
|
||||
|
||||
s.dependency 'AFNetworking', '~> 3'
|
||||
s.dependency 'JSONModel', '~> 1.2'
|
||||
s.dependency 'JSONModel', '~> 1.4'
|
||||
s.dependency 'ISO8601', '~> 0.6'
|
||||
end
|
||||
|
||||
|
@ -352,7 +352,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
|
||||
NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"petstore_auth", @"api_key"];
|
||||
NSArray *authSettings = @[@"api_key", @"petstore_auth"];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
|
@ -54,7 +54,49 @@ extern NSString *const SWGResponseObjectErrorKey;
|
||||
|
||||
|
||||
/**
|
||||
* Updates header parameters and query parameters for authentication
|
||||
* Gets if the client is unreachable
|
||||
*
|
||||
* @return The client offline state
|
||||
*/
|
||||
+(BOOL) getOfflineState;
|
||||
|
||||
/**
|
||||
* Sets the client reachability, this may be overridden by the reachability manager if reachability changes
|
||||
*
|
||||
* @param status The client reachability status.
|
||||
*/
|
||||
+(void) setReachabilityStatus:(AFNetworkReachabilityStatus) status;
|
||||
|
||||
/**
|
||||
* Gets the client reachability
|
||||
*
|
||||
* @return The client reachability.
|
||||
*/
|
||||
+(AFNetworkReachabilityStatus) getReachabilityStatus;
|
||||
|
||||
/**
|
||||
* Gets the next request id
|
||||
*
|
||||
* @return The next executed request id.
|
||||
*/
|
||||
+(NSNumber*) nextRequestId;
|
||||
|
||||
/**
|
||||
* Generates request id and add it to the queue
|
||||
*
|
||||
* @return The next executed request id.
|
||||
*/
|
||||
+(NSNumber*) queueRequest;
|
||||
|
||||
/**
|
||||
* Removes request id from the queue
|
||||
*
|
||||
* @param requestId The request which will be removed.
|
||||
*/
|
||||
+(void) cancelRequest:(NSNumber*)requestId;
|
||||
|
||||
/**
|
||||
* Customizes the behavior when the reachability changed
|
||||
*
|
||||
* @param headers The header parameter will be udpated, passed by pointer to pointer.
|
||||
* @param querys The query parameters will be updated, passed by pointer to pointer.
|
||||
|
@ -117,7 +117,7 @@
|
||||
/**
|
||||
* Sets the prefix for API key
|
||||
*
|
||||
* @param apiKeyPrefix API key prefix.
|
||||
* @param prefix API key prefix.
|
||||
* @param identifier API key identifier.
|
||||
*/
|
||||
- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier;
|
||||
@ -157,7 +157,7 @@
|
||||
/**
|
||||
* Removes header from defaultHeaders
|
||||
*
|
||||
* @param Header name.
|
||||
* @param key Header name.
|
||||
*/
|
||||
-(void) removeDefaultHeaderForKey:(NSString*)key;
|
||||
|
||||
@ -170,7 +170,7 @@
|
||||
-(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key;
|
||||
|
||||
/**
|
||||
* @param Header key name.
|
||||
* @param key Header key name.
|
||||
*/
|
||||
-(NSString*) defaultHeaderForKey:(NSString*)key;
|
||||
|
||||
|
@ -103,13 +103,6 @@
|
||||
|
||||
- (NSDictionary *) authSettings {
|
||||
return @{
|
||||
@"petstore_auth":
|
||||
@{
|
||||
@"type": @"oauth",
|
||||
@"in": @"header",
|
||||
@"key": @"Authorization",
|
||||
@"value": [self getAccessToken]
|
||||
},
|
||||
@"api_key":
|
||||
@{
|
||||
@"type": @"api_key",
|
||||
@ -117,6 +110,13 @@
|
||||
@"key": @"api_key",
|
||||
@"value": [self getApiKeyWithPrefix:@"api_key"]
|
||||
},
|
||||
@"petstore_auth":
|
||||
@{
|
||||
@"type": @"oauth",
|
||||
@"in": @"header",
|
||||
@"key": @"Authorization",
|
||||
@"value": [self getAccessToken]
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ extern NSInteger const SWGUnknownResponseObjectErrorCode;
|
||||
* Deserializes the given data to Objective-C object.
|
||||
*
|
||||
* @param data The data will be deserialized.
|
||||
* @param class The type of objective-c object.
|
||||
* @param className The type of objective-c object.
|
||||
* @param error The error
|
||||
*/
|
||||
- (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper {
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
|
||||
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper {
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
|
||||
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user