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

This commit is contained in:
wing328
2016-11-09 16:37:11 +08:00
158 changed files with 1842 additions and 1165 deletions

View File

@@ -792,6 +792,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
- [Plexxi](http://www.plexxi.com) - [Plexxi](http://www.plexxi.com)
- [Pixoneye](http://www.pixoneye.com/) - [Pixoneye](http://www.pixoneye.com/)
- [PostAffiliatePro](https://www.postaffiliatepro.com/) - [PostAffiliatePro](https://www.postaffiliatepro.com/)
- [QAdept](http://qadept.com/)
- [QuantiModo](https://quantimo.do/) - [QuantiModo](https://quantimo.do/)
- [Rapid7](https://rapid7.com/) - [Rapid7](https://rapid7.com/)
- [Reload! A/S](https://reload.dk/) - [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. 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 License
------- -------

View File

@@ -310,7 +310,10 @@ public class CodeGenMojo extends AbstractMojo {
} }
if (addCompileSourceRoot) { 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); project.addCompileSourceRoot(sourceJavaFolder);
} }
} }

View File

@@ -1892,7 +1892,11 @@ public class DefaultCodegen {
for (String key : consumes) { for (String key : consumes) {
Map<String, String> mediaType = new HashMap<String, String>(); Map<String, String> mediaType = new HashMap<String, String>();
// escape quotation to avoid code injection // 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; count += 1;
if (count < consumes.size()) { if (count < consumes.size()) {
mediaType.put("hasMore", "true"); mediaType.put("hasMore", "true");
@@ -1926,7 +1930,11 @@ public class DefaultCodegen {
for (String key : produces) { for (String key : produces) {
Map<String, String> mediaType = new HashMap<String, String>(); Map<String, String> mediaType = new HashMap<String, String>();
// escape quotation to avoid code injection // 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; count += 1;
if (count < produces.size()) { if (count < produces.size()) {
mediaType.put("hasMore", "true"); mediaType.put("hasMore", "true");

View File

@@ -141,7 +141,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
config.additionalProperties().put("generatedDate", DateTime.now().toString()); config.additionalProperties().put("generatedDate", DateTime.now().toString());
config.additionalProperties().put("generatorClass", config.getClass().toString()); config.additionalProperties().put("generatorClass", config.getClass().toString());
config.additionalProperties().put("inputSpec", config.getInputSpec()); config.additionalProperties().put("inputSpec", config.getInputSpec());
if (swagger.getInfo() != null) { if (swagger.getInfo() != null) {
Info info = swagger.getInfo(); Info info = swagger.getInfo();
if (info.getTitle() != null) { if (info.getTitle() != null) {
@@ -405,6 +405,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
operation.put("classname", config.toApiName(tag)); operation.put("classname", config.toApiName(tag));
operation.put("classVarName", config.toApiVarName(tag)); operation.put("classVarName", config.toApiVarName(tag));
operation.put("importPath", config.toApiImport(tag)); operation.put("importPath", config.toApiImport(tag));
operation.put("classFilename", config.toApiFilename(tag));
if(!config.vendorExtensions().isEmpty()) { if(!config.vendorExtensions().isEmpty()) {
operation.put("vendorExtensions", config.vendorExtensions()); operation.put("vendorExtensions", config.vendorExtensions());

View File

@@ -291,7 +291,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
typeMapping.put("DateTime", "OffsetDateTime"); typeMapping.put("DateTime", "OffsetDateTime");
importMapping.put("OffsetDateTime", "java.time.OffsetDateTime"); importMapping.put("OffsetDateTime", "java.time.OffsetDateTime");
} }
} else { } else if (dateLibrary.equals("legacy")) {
additionalProperties.put("legacyDates", "true"); additionalProperties.put("legacyDates", "true");
} }
} }

View File

@@ -139,8 +139,11 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
} }
} }
} }
if ( operation.returnType == null ) { if ( operation.returnType == null ) {
operation.returnType = "void"; 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") ) { } else if ( operation.returnType.startsWith("List") ) {
String rt = operation.returnType; String rt = operation.returnType;
int end = rt.lastIndexOf(">"); int end = rt.lastIndexOf(">");

View File

@@ -10,6 +10,8 @@ public class AspNet5ServerCodegen extends AspNetCoreServerCodegen {
public AspNet5ServerCodegen() { public AspNet5ServerCodegen() {
super(); super();
embeddedTemplateDir = templateDir = "aspnetcore";
} }
@Override @Override

View File

@@ -136,8 +136,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen implements BeanValida
} }
if ("feign".equals(getLibrary())) { if ("feign".equals(getLibrary())) {
supportingFiles.add(new SupportingFile("FormAwareEncoder.mustache", invokerFolder, "FormAwareEncoder.java"));
additionalProperties.put("jackson", "true"); additionalProperties.put("jackson", "true");
supportingFiles.add(new SupportingFile("ParamExpander.mustache", invokerFolder, "ParamExpander.java"));
} else if ("okhttp-gson".equals(getLibrary()) || StringUtils.isEmpty(getLibrary())) { } else if ("okhttp-gson".equals(getLibrary()) || StringUtils.isEmpty(getLibrary())) {
// the "okhttp-gson" library template requires "ApiCallback.mustache" for async call // the "okhttp-gson" library template requires "ApiCallback.mustache" for async call
supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java")); supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java"));

View File

@@ -24,6 +24,7 @@ import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
import feign.Feign; import feign.Feign;
import feign.RequestInterceptor; import feign.RequestInterceptor;
import feign.form.FormEncoder;
import feign.jackson.JacksonDecoder; import feign.jackson.JacksonDecoder;
import feign.jackson.JacksonEncoder; import feign.jackson.JacksonEncoder;
import feign.slf4j.Slf4jLogger; import feign.slf4j.Slf4jLogger;
@@ -43,7 +44,7 @@ public class ApiClient {
objectMapper = createObjectMapper(); objectMapper = createObjectMapper();
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>(); apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
feignBuilder = Feign.builder() feignBuilder = Feign.builder()
.encoder(new FormAwareEncoder(new JacksonEncoder(objectMapper))) .encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
.decoder(new JacksonDecoder(objectMapper)) .decoder(new JacksonDecoder(objectMapper))
.logger(new Slf4jLogger()); .logger(new Slf4jLogger());
} }

View File

@@ -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);
}
}

View File

@@ -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();
}
}

View File

@@ -1,6 +1,9 @@
package {{package}}; package {{package}};
import {{invokerPackage}}.ApiClient; import {{invokerPackage}}.ApiClient;
{{#legacyDates}}
import {{invokerPackage}}.ParamExpander;
{{/legacyDates}}
{{#imports}}import {{import}}; {{#imports}}import {{import}};
{{/imports}} {{/imports}}
@@ -25,12 +28,12 @@ public interface {{classname}} extends ApiClient.Api {
*/ */
@RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{#hasMore}}&{{/hasMore}}{{/queryParams}}") @RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{#hasMore}}&{{/hasMore}}{{/queryParams}}")
@Headers({ @Headers({
"Content-type: {{vendorExtensions.x-contentType}}", "Content-Type: {{vendorExtensions.x-contentType}}",
"Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}}
"{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{#hasMore}}, "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{#hasMore}},
{{/hasMore}}{{/headerParams}} {{/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}} {{/operation}}
{{/operations}} {{/operations}}
} }

View File

@@ -97,6 +97,7 @@ ext {
swagger_annotations_version = "1.5.9" swagger_annotations_version = "1.5.9"
jackson_version = "{{^threetenbp}}2.7.5{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" jackson_version = "{{^threetenbp}}2.7.5{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}"
feign_version = "8.17.0" feign_version = "8.17.0"
feign_form_version = "2.0.2"
junit_version = "4.12" junit_version = "4.12"
oltu_version = "1.0.1" oltu_version = "1.0.1"
} }
@@ -106,6 +107,7 @@ dependencies {
compile "com.netflix.feign:feign-core:$feign_version" compile "com.netflix.feign:feign-core:$feign_version"
compile "com.netflix.feign:feign-jackson:$feign_version" compile "com.netflix.feign:feign-jackson:$feign_version"
compile "com.netflix.feign:feign-slf4j:$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-core:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"

View File

@@ -13,18 +13,11 @@ lazy val root = (project in file(".")).
"com.netflix.feign" % "feign-core" % "8.16.0" % "compile", "com.netflix.feign" % "feign-core" % "8.16.0" % "compile",
"com.netflix.feign" % "feign-jackson" % "8.17.0" % "compile", "com.netflix.feign" % "feign-jackson" % "8.17.0" % "compile",
"com.netflix.feign" % "feign-slf4j" % "8.16.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", "io.github.openfeign.form" % "feign-form" % "2.0.2" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "{{^threetenbp}}2.7.5{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" % "compile", "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "{{^threetenbp}}2.7.5{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5" % "compile",
{{#joda}} "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}" % "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}}
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile",
"com.brsanthu" % "migbase64" % "2.2" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile",
"junit" % "junit" % "4.12" % "test", "junit" % "junit" % "4.12" % "test",

View File

@@ -1,189 +1,195 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>{{groupId}}</groupId> <groupId>{{groupId}}</groupId>
<artifactId>{{artifactId}}</artifactId> <artifactId>{{artifactId}}</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>{{artifactId}}</name> <name>{{artifactId}}</name>
<version>{{artifactVersion}}</version> <version>{{artifactVersion}}</version>
<scm> <scm>
<connection>scm:git:git@github.com:swagger-api/swagger-mustache.git</connection> <connection>scm:git:git@github.com:swagger-api/swagger-mustache.git</connection>
<developerConnection>scm:git:git@github.com:swagger-api/swagger-codegen.git</developerConnection> <developerConnection>scm:git:git@github.com:swagger-api/swagger-codegen.git</developerConnection>
<url>https://github.com/swagger-api/swagger-codegen</url> <url>https://github.com/swagger-api/swagger-codegen</url>
</scm> </scm>
<prerequisites> <prerequisites>
<maven>2.2.0</maven> <maven>2.2.0</maven>
</prerequisites> </prerequisites>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version> <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> <configuration>
<systemProperties> <outputDirectory>${project.build.directory}/lib</outputDirectory>
<property>
<name>loggerPath</name>
<value>conf/log4j.properties</value>
</property>
</systemProperties>
<argLine>-Xms512m -Xmx1500m</argLine>
<parallel>methods</parallel>
<forkMode>pertest</forkMode>
</configuration> </configuration>
</plugin> </execution>
<plugin> </executions>
<artifactId>maven-dependency-plugin</artifactId> </plugin>
<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 --> <!-- attach test jar -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>2.2</version> <version>2.2</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>
<goal>jar</goal> <goal>jar</goal>
<goal>test-jar</goal> <goal>test-jar</goal>
</goals> </goals>
</execution> </execution>
</executions> </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> <configuration>
<sources>
<source>src/main/java</source>
</sources>
</configuration> </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> <!-- HTTP client: Netflix Feign -->
<groupId>org.codehaus.mojo</groupId> <dependency>
<artifactId>build-helper-maven-plugin</artifactId> <groupId>com.netflix.feign</groupId>
<executions> <artifactId>feign-core</artifactId>
<execution> <version>${feign-version}</version>
<id>add_sources</id> </dependency>
<phase>generate-sources</phase> <dependency>
<goals> <groupId>com.netflix.feign</groupId>
<goal>add-source</goal> <artifactId>feign-jackson</artifactId>
</goals> <version>${feign-version}</version>
<configuration> </dependency>
<sources> <dependency>
<source>src/main/java</source> <groupId>com.netflix.feign</groupId>
</sources> <artifactId>feign-slf4j</artifactId>
</configuration> <version>${feign-version}</version>
</execution> </dependency>
<execution> <dependency>
<id>add_test_sources</id> <groupId>io.github.openfeign.form</groupId>
<phase>generate-test-sources</phase> <artifactId>feign-form</artifactId>
<goals> <version>${feign-form-version}</version>
<goal>add-test-source</goal> </dependency>
</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 --> <!-- JSON processing: jackson -->
<dependency> <dependency>
<groupId>com.netflix.feign</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>feign-core</artifactId> <artifactId>jackson-core</artifactId>
<version>${feign-version}</version> <version>${jackson-version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.netflix.feign</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>feign-jackson</artifactId> <artifactId>jackson-annotations</artifactId>
<version>${feign-version}</version> <version>${jackson-version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.netflix.feign</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>feign-slf4j</artifactId> <artifactId>jackson-databind</artifactId>
<version>${feign-version}</version> <version>${jackson-version}</version>
</dependency> </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 --> <!-- test dependencies -->
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>junit</groupId>
<artifactId>jackson-core</artifactId> <artifactId>junit</artifactId>
<version>${jackson-version}</version> <version>${junit-version}</version>
</dependency> <scope>test</scope>
<dependency> </dependency>
<groupId>com.fasterxml.jackson.core</groupId> </dependencies>
<artifactId>jackson-annotations</artifactId> <properties>
<version>${jackson-version}</version> <java.version>{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}</java.version>
</dependency> <maven.compiler.source>${java.version}</maven.compiler.source>
<dependency> <maven.compiler.target>${java.version}</maven.compiler.target>
<groupId>com.fasterxml.jackson.core</groupId> <swagger-core-version>1.5.9</swagger-core-version>
<artifactId>jackson-databind</artifactId> <feign-version>8.17.0</feign-version>
<version>${jackson-version}</version> <feign-form-version>2.0.2</feign-form-version>
</dependency> <jackson-version>2.7.5</jackson-version>
{{#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>
<junit-version>4.12</junit-version> <junit-version>4.12</junit-version>
<maven-plugin-version>1.0.0</maven-plugin-version> <maven-plugin-version>1.0.0</maven-plugin-version>
<oltu-version>1.0.1</oltu-version> <oltu-version>1.0.1</oltu-version>

View File

@@ -63,12 +63,9 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
{{/maximum}} {{/maximum}}
* @return {{name}} * @return {{name}}
**/ **/
{{#vendorExtensions.extraAnnotation}}
{{{vendorExtensions.extraAnnotation}}}
{{/vendorExtensions.extraAnnotation}}
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") {{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
{{#vendorExtensions.extraAnnotation}} {{#vendorExtensions.extraAnnotation}}
{{vendorExtensions.extraAnnotation}} {{{vendorExtensions.extraAnnotation}}}
{{/vendorExtensions.extraAnnotation}} {{/vendorExtensions.extraAnnotation}}
public {{{datatypeWithEnum}}} {{getter}}() { public {{{datatypeWithEnum}}} {{getter}}() {
return {{name}}; return {{name}};

View File

@@ -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}}) { public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
// TODO: Implement... // TODO: Implement...
{{#returnType}}return null;{{/returnType}} {{^vendorExtensions.x-java-is-response-void}}return null;{{/vendorExtensions.x-java-is-response-void}}
} }
{{/operation}} {{/operation}}

View File

@@ -1,9 +1,9 @@
@XmlType(name="{{datatypeWithEnum}}") @XmlType(name="{{datatypeWithEnum}}")
@XmlEnum @XmlEnum({{datatype}}.class)
public enum {{datatypeWithEnum}} { public enum {{datatypeWithEnum}} {
{{#allowableValues}} {{#allowableValues}}
{{#enumVars}}{{name}}({{datatype}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}} {{#enumVars}}@XmlEnumValue({{{value}}}) {{name}}({{datatype}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
{{/allowableValues}} {{/allowableValues}}
@@ -17,7 +17,17 @@ public enum {{datatypeWithEnum}} {
return value; return value;
} }
@Override
public String toString() {
return String.valueOf(value);
}
public static {{datatypeWithEnum}} fromValue(String v) { 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;
} }
} }

View File

@@ -5,6 +5,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
{{#hasVars}} @XmlType(name = "{{classname}}", propOrder = {{#hasVars}} @XmlType(name = "{{classname}}", propOrder =

View File

@@ -20,5 +20,14 @@
{{/allowableValues}} {{/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; return exports;
})); }));

View File

@@ -15,8 +15,8 @@ import {{package}}.NotFoundException;
import java.io.InputStream; import java.io.InputStream;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.wso2.msf4j.formparam.FormDataParam;
import org.glassfish.jersey.media.multipart.FormDataParam; import org.wso2.msf4j.formparam.FileInfo;
import javax.ws.rs.core.Context; import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;

View File

@@ -3,7 +3,8 @@ package {{package}};
import {{package}}.*; import {{package}}.*;
import {{modelPackage}}.*; 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}}import {{import}};
{{/imports}} {{/imports}}

View File

@@ -11,7 +11,8 @@ import {{package}}.NotFoundException;
import java.io.InputStream; 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.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;

View File

@@ -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}} {{#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}}") InputStream {{paramName}}InputStream,
@FormDataParam("{{paramName}}") FormDataContentDisposition {{paramName}}Detail{{/isFile}}{{/isFormParam}} @FormDataParam("{{paramName}}") FileInfo {{paramName}}Detail{{/isFile}}{{/isFormParam}}

View File

@@ -66,16 +66,6 @@
<artifactId>jackson-datatype-joda</artifactId> <artifactId>jackson-datatype-joda</artifactId>
<version>2.4.1</version> <version>2.4.1</version>
</dependency> </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> </dependencies>
<repositories> <repositories>

View File

@@ -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}}

View File

@@ -16,7 +16,7 @@ part 'auth/api_key_auth.dart';
part 'auth/oauth.dart'; part 'auth/oauth.dart';
part 'auth/http_basic_auth.dart'; part 'auth/http_basic_auth.dart';
{{#apiInfo}}{{#apis}}part 'api/{{classVarName}}_api.dart'; {{#apiInfo}}{{#apis}}part 'api/{{classFilename}}.dart';
{{/apis}}{{/apiInfo}} {{/apis}}{{/apiInfo}}
{{#models}}{{#model}}part 'model/{{classFilename}}.dart'; {{#models}}{{#model}}part 'model/{{classFilename}}.dart';
{{/model}}{{/models}} {{/model}}{{/models}}

View File

@@ -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 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. * @param querys The query parameters will be updated, passed by pointer to pointer.

View File

@@ -95,7 +95,7 @@
/** /**
* Sets the prefix for API key * Sets the prefix for API key
* *
* @param apiKeyPrefix API key prefix. * @param prefix API key prefix.
* @param identifier API key identifier. * @param identifier API key identifier.
*/ */
- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier; - (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier;
@@ -135,7 +135,7 @@
/** /**
* Removes header from defaultHeaders * Removes header from defaultHeaders
* *
* @param Header name. * @param key Header name.
*/ */
-(void) removeDefaultHeaderForKey:(NSString*)key; -(void) removeDefaultHeaderForKey:(NSString*)key;
@@ -148,7 +148,7 @@
-(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key; -(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key;
/** /**
* @param Header key name. * @param key Header key name.
*/ */
-(NSString*) defaultHeaderForKey:(NSString*)key; -(NSString*) defaultHeaderForKey:(NSString*)key;

View File

@@ -28,7 +28,7 @@ extern NSInteger const {{classPrefix}}UnknownResponseObjectErrorCode;
* Deserializes the given data to Objective-C object. * Deserializes the given data to Objective-C object.
* *
* @param data The data will be deserialized. * @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 * @param error The error
*/ */
- (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error; - (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error;

View File

@@ -43,7 +43,7 @@
* This method is used by `JSONModel`. * This method is used by `JSONModel`.
*/ */
+ (JSONKeyMapper *)keyMapper { + (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ {{#vars}}@"{{baseName}}": @"{{name}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }]; return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ {{#vars}}@"{{name}}": @"{{baseName}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }];
} }
/** /**

View File

@@ -31,7 +31,7 @@ Pod::Spec.new do |s|
{{#useCoreData}} s.resources = '{{podName}}/**/*.{xcdatamodeld,xcdatamodel}'{{/useCoreData}} {{#useCoreData}} s.resources = '{{podName}}/**/*.{xcdatamodeld,xcdatamodel}'{{/useCoreData}}
s.dependency 'AFNetworking', '~> 3' s.dependency 'AFNetworking', '~> 3'
s.dependency 'JSONModel', '~> 1.2' s.dependency 'JSONModel', '~> 1.4'
s.dependency 'ISO8601', '~> 0.6' s.dependency 'ISO8601', '~> 0.6'
end end

View File

@@ -462,7 +462,7 @@ class ApiClient(object):
content_types = list(map(lambda x: x.lower(), content_types)) 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' return 'application/json'
else: else:
return content_types[0] return content_types[0]

View File

@@ -125,10 +125,11 @@ module {{moduleName}}
# application/json # application/json
# application/json; charset=UTF8 # application/json; charset=UTF8
# APPLICATION/JSON # APPLICATION/JSON
# */*
# @param [String] mime MIME # @param [String] mime MIME
# @return [Boolean] True if the MIME is application/json # @return [Boolean] True if the MIME is application/json
def json_mime?(mime) def json_mime?(mime)
!(mime =~ /\Aapplication\/json(;.*)?\z/i).nil? (mime == "*/*") || !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
end end
# Deserialize the response to the given return type. # Deserialize the response to the given return type.

View File

@@ -613,9 +613,9 @@ paths:
descriptions: To test enum parameters descriptions: To test enum parameters
operationId: testEnumParameters operationId: testEnumParameters
consumes: consumes:
- application/json - "*/*"
produces: produces:
- application/json - "*/*"
parameters: parameters:
- name: enum_form_string_array - name: enum_form_string_array
type: array type: array

12
pom.xml
View File

@@ -463,6 +463,18 @@
<module>samples/server/petstore/java-msf4/</module> <module>samples/server/petstore/java-msf4/</module>
</modules> </modules>
</profile> </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> <profile>
<id>jaxrs-resteasy-server</id> <id>jaxrs-resteasy-server</id>
<activation> <activation>

View File

@@ -97,6 +97,7 @@ ext {
swagger_annotations_version = "1.5.9" swagger_annotations_version = "1.5.9"
jackson_version = "2.6.4" jackson_version = "2.6.4"
feign_version = "8.17.0" feign_version = "8.17.0"
feign_form_version = "2.0.2"
junit_version = "4.12" junit_version = "4.12"
oltu_version = "1.0.1" oltu_version = "1.0.1"
} }
@@ -106,6 +107,10 @@ dependencies {
compile "com.netflix.feign:feign-core:$feign_version" compile "com.netflix.feign:feign-core:$feign_version"
compile "com.netflix.feign:feign-jackson:$feign_version" compile "com.netflix.feign:feign-jackson:$feign_version"
compile "com.netflix.feign:feign-slf4j:$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 "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_version",
compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version"
compile "com.brsanthu:migbase64:2.2" compile "com.brsanthu:migbase64:2.2"

View File

@@ -13,7 +13,11 @@ lazy val root = (project in file(".")).
"com.netflix.feign" % "feign-core" % "8.16.0" % "compile", "com.netflix.feign" % "feign-core" % "8.16.0" % "compile",
"com.netflix.feign" % "feign-jackson" % "8.17.0" % "compile", "com.netflix.feign" % "feign-jackson" % "8.17.0" % "compile",
"com.netflix.feign" % "feign-slf4j" % "8.16.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", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile",
"com.brsanthu" % "migbase64" % "2.2" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile",
"junit" % "junit" % "4.12" % "test", "junit" % "junit" % "4.12" % "test",

View File

@@ -1,158 +1,179 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <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> <groupId>io.swagger</groupId>
<artifactId>swagger-petstore-feign</artifactId> <artifactId>swagger-annotations</artifactId>
<packaging>jar</packaging> <version>${swagger-core-version}</version>
<name>swagger-petstore-feign</name> </dependency>
<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> <!-- HTTP client: Netflix Feign -->
<plugins> <dependency>
<plugin> <groupId>com.netflix.feign</groupId>
<groupId>org.apache.maven.plugins</groupId> <artifactId>feign-core</artifactId>
<artifactId>maven-surefire-plugin</artifactId> <version>${feign-version}</version>
<version>2.12</version> </dependency>
<configuration> <dependency>
<systemProperties> <groupId>com.netflix.feign</groupId>
<property> <artifactId>feign-jackson</artifactId>
<name>loggerPath</name> <version>${feign-version}</version>
<value>conf/log4j.properties</value> </dependency>
</property> <dependency>
</systemProperties> <groupId>com.netflix.feign</groupId>
<argLine>-Xms512m -Xmx1500m</argLine> <artifactId>feign-slf4j</artifactId>
<parallel>methods</parallel> <version>${feign-version}</version>
<forkMode>pertest</forkMode> </dependency>
</configuration> <dependency>
</plugin> <groupId>io.github.openfeign.form</groupId>
<plugin> <artifactId>feign-form</artifactId>
<artifactId>maven-dependency-plugin</artifactId> <version>${feign-form-version}</version>
<executions> </dependency>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- attach test jar --> <!-- JSON processing: jackson -->
<plugin> <dependency>
<groupId>org.apache.maven.plugins</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>jackson-core</artifactId>
<version>2.2</version> <version>${jackson-version}</version>
<executions> </dependency>
<execution> <dependency>
<goals> <groupId>com.fasterxml.jackson.core</groupId>
<goal>jar</goal> <artifactId>jackson-annotations</artifactId>
<goal>test-jar</goal> <version>${jackson-version}</version>
</goals> </dependency>
</execution> <dependency>
</executions> <groupId>com.fasterxml.jackson.core</groupId>
<configuration> <artifactId>jackson-databind</artifactId>
</configuration> <version>${jackson-version}</version>
</plugin> </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> <!-- test dependencies -->
<groupId>org.codehaus.mojo</groupId> <dependency>
<artifactId>build-helper-maven-plugin</artifactId> <groupId>junit</groupId>
<executions> <artifactId>junit</artifactId>
<execution> <version>${junit-version}</version>
<id>add_sources</id> <scope>test</scope>
<phase>generate-sources</phase> </dependency>
<goals> </dependencies>
<goal>add-source</goal> <properties>
</goals> <java.version>1.7</java.version>
<configuration> <maven.compiler.source>${java.version}</maven.compiler.source>
<sources> <maven.compiler.target>${java.version}</maven.compiler.target>
<source>src/main/java</source> <swagger-core-version>1.5.9</swagger-core-version>
</sources> <feign-version>8.17.0</feign-version>
</configuration> <feign-form-version>2.0.2</feign-form-version>
</execution> <jackson-version>2.7.5</jackson-version>
<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>
<junit-version>4.12</junit-version> <junit-version>4.12</junit-version>
<maven-plugin-version>1.0.0</maven-plugin-version> <maven-plugin-version>1.0.0</maven-plugin-version>
<oltu-version>1.0.1</oltu-version> <oltu-version>1.0.1</oltu-version>

View File

@@ -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.AuthenticationRequestBuilder;
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder;
import org.threeten.bp.Instant; import org.threeten.bp.*;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.ZonedDateTime;
import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
@@ -16,6 +14,7 @@ import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
import feign.Feign; import feign.Feign;
import feign.RequestInterceptor; import feign.RequestInterceptor;
import feign.form.FormEncoder;
import feign.jackson.JacksonDecoder; import feign.jackson.JacksonDecoder;
import feign.jackson.JacksonEncoder; import feign.jackson.JacksonEncoder;
import feign.slf4j.Slf4jLogger; import feign.slf4j.Slf4jLogger;
@@ -35,7 +34,7 @@ public class ApiClient {
objectMapper = createObjectMapper(); objectMapper = createObjectMapper();
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>(); apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
feignBuilder = Feign.builder() feignBuilder = Feign.builder()
.encoder(new FormAwareEncoder(new JacksonEncoder(objectMapper))) .encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
.decoder(new JacksonDecoder(objectMapper)) .decoder(new JacksonDecoder(objectMapper))
.logger(new Slf4jLogger()); .logger(new Slf4jLogger());
} }

View File

@@ -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);
}
}

View File

@@ -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();
}
}

View File

@@ -3,8 +3,8 @@ package io.swagger.client.api;
import io.swagger.client.ApiClient; import io.swagger.client.ApiClient;
import io.swagger.client.model.Client; import io.swagger.client.model.Client;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.LocalDate; import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
@@ -25,7 +25,7 @@ public interface FakeApi extends ApiClient.Api {
*/ */
@RequestLine("PATCH /fake") @RequestLine("PATCH /fake")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
Client testClientModel(Client body); Client testClientModel(Client body);
@@ -51,7 +51,7 @@ public interface FakeApi extends ApiClient.Api {
*/ */
@RequestLine("POST /fake") @RequestLine("POST /fake")
@Headers({ @Headers({
"Content-type: application/xml; charset&#x3D;utf-8", "Content-Type: application/xml; charset&#x3D;utf-8",
"Accept: application/xml; charset&#x3D;utf-8,application/json; charset&#x3D;utf-8", "Accept: application/xml; charset&#x3D;utf-8,application/json; charset&#x3D;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); 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}") @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: */*",
"Accept: application/json", "Accept: */*",
"enum_header_string_array: {enumHeaderStringArray}", "enum_header_string_array: {enumHeaderStringArray}",
"enum_header_string: {enumHeaderString}" "enum_header_string: {enumHeaderString}"

View File

@@ -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);
}

View File

@@ -3,8 +3,8 @@ package io.swagger.client.api;
import io.swagger.client.ApiClient; import io.swagger.client.ApiClient;
import io.swagger.client.model.Pet; import io.swagger.client.model.Pet;
import io.swagger.client.model.ModelApiResponse;
import java.io.File; import java.io.File;
import io.swagger.client.model.ModelApiResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@@ -24,7 +24,7 @@ public interface PetApi extends ApiClient.Api {
*/ */
@RequestLine("POST /pet") @RequestLine("POST /pet")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
void addPet(Pet body); void addPet(Pet body);
@@ -38,7 +38,7 @@ public interface PetApi extends ApiClient.Api {
*/ */
@RequestLine("DELETE /pet/{petId}") @RequestLine("DELETE /pet/{petId}")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
"api_key: {apiKey}" "api_key: {apiKey}"
}) })
@@ -52,7 +52,7 @@ public interface PetApi extends ApiClient.Api {
*/ */
@RequestLine("GET /pet/findByStatus?status={status}") @RequestLine("GET /pet/findByStatus?status={status}")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
List<Pet> findPetsByStatus(@Param("status") List<String> status); List<Pet> findPetsByStatus(@Param("status") List<String> status);
@@ -65,7 +65,7 @@ public interface PetApi extends ApiClient.Api {
*/ */
@RequestLine("GET /pet/findByTags?tags={tags}") @RequestLine("GET /pet/findByTags?tags={tags}")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
List<Pet> findPetsByTags(@Param("tags") List<String> tags); List<Pet> findPetsByTags(@Param("tags") List<String> tags);
@@ -78,7 +78,7 @@ public interface PetApi extends ApiClient.Api {
*/ */
@RequestLine("GET /pet/{petId}") @RequestLine("GET /pet/{petId}")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
Pet getPetById(@Param("petId") Long petId); Pet getPetById(@Param("petId") Long petId);
@@ -91,7 +91,7 @@ public interface PetApi extends ApiClient.Api {
*/ */
@RequestLine("PUT /pet") @RequestLine("PUT /pet")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
void updatePet(Pet body); void updatePet(Pet body);
@@ -106,7 +106,7 @@ public interface PetApi extends ApiClient.Api {
*/ */
@RequestLine("POST /pet/{petId}") @RequestLine("POST /pet/{petId}")
@Headers({ @Headers({
"Content-type: application/x-www-form-urlencoded", "Content-Type: application/x-www-form-urlencoded",
"Accept: application/json", "Accept: application/json",
}) })
void updatePetWithForm(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); 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") @RequestLine("POST /pet/{petId}/uploadImage")
@Headers({ @Headers({
"Content-type: multipart/form-data", "Content-Type: multipart/form-data",
"Accept: application/json", "Accept: application/json",
}) })
ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);

View File

@@ -22,7 +22,7 @@ public interface StoreApi extends ApiClient.Api {
*/ */
@RequestLine("DELETE /store/order/{orderId}") @RequestLine("DELETE /store/order/{orderId}")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
void deleteOrder(@Param("orderId") String orderId); void deleteOrder(@Param("orderId") String orderId);
@@ -34,7 +34,7 @@ public interface StoreApi extends ApiClient.Api {
*/ */
@RequestLine("GET /store/inventory") @RequestLine("GET /store/inventory")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
Map<String, Integer> getInventory(); Map<String, Integer> getInventory();
@@ -47,7 +47,7 @@ public interface StoreApi extends ApiClient.Api {
*/ */
@RequestLine("GET /store/order/{orderId}") @RequestLine("GET /store/order/{orderId}")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
Order getOrderById(@Param("orderId") Long orderId); Order getOrderById(@Param("orderId") Long orderId);
@@ -60,7 +60,7 @@ public interface StoreApi extends ApiClient.Api {
*/ */
@RequestLine("POST /store/order") @RequestLine("POST /store/order")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
Order placeOrder(Order body); Order placeOrder(Order body);

View File

@@ -22,7 +22,7 @@ public interface UserApi extends ApiClient.Api {
*/ */
@RequestLine("POST /user") @RequestLine("POST /user")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
void createUser(User body); void createUser(User body);
@@ -35,7 +35,7 @@ public interface UserApi extends ApiClient.Api {
*/ */
@RequestLine("POST /user/createWithArray") @RequestLine("POST /user/createWithArray")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
void createUsersWithArrayInput(List<User> body); void createUsersWithArrayInput(List<User> body);
@@ -48,7 +48,7 @@ public interface UserApi extends ApiClient.Api {
*/ */
@RequestLine("POST /user/createWithList") @RequestLine("POST /user/createWithList")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
void createUsersWithListInput(List<User> body); void createUsersWithListInput(List<User> body);
@@ -61,7 +61,7 @@ public interface UserApi extends ApiClient.Api {
*/ */
@RequestLine("DELETE /user/{username}") @RequestLine("DELETE /user/{username}")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
void deleteUser(@Param("username") String username); void deleteUser(@Param("username") String username);
@@ -74,7 +74,7 @@ public interface UserApi extends ApiClient.Api {
*/ */
@RequestLine("GET /user/{username}") @RequestLine("GET /user/{username}")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
User getUserByName(@Param("username") String username); User getUserByName(@Param("username") String username);
@@ -88,7 +88,7 @@ public interface UserApi extends ApiClient.Api {
*/ */
@RequestLine("GET /user/login?username={username}&password={password}") @RequestLine("GET /user/login?username={username}&password={password}")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
String loginUser(@Param("username") String username, @Param("password") String password); String loginUser(@Param("username") String username, @Param("password") String password);
@@ -100,7 +100,7 @@ public interface UserApi extends ApiClient.Api {
*/ */
@RequestLine("GET /user/logout") @RequestLine("GET /user/logout")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
void logoutUser(); void logoutUser();
@@ -114,7 +114,7 @@ public interface UserApi extends ApiClient.Api {
*/ */
@RequestLine("PUT /user/{username}") @RequestLine("PUT /user/{username}")
@Headers({ @Headers({
"Content-type: application/json", "Content-Type: application/json",
"Accept: application/json", "Accept: application/json",
}) })
void updateUser(@Param("username") String username, User body); void updateUser(@Param("username") String username, User body);

View File

@@ -110,6 +110,7 @@ public class AdditionalPropertiesClass {
return Objects.hash(mapProperty, mapOfMapProperty); return Objects.hash(mapProperty, mapOfMapProperty);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -97,6 +97,7 @@ public class Animal {
return Objects.hash(className, color); return Objects.hash(className, color);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -52,6 +52,7 @@ public class AnimalFarm extends ArrayList<Animal> {
return Objects.hash(super.hashCode()); return Objects.hash(super.hashCode());
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -83,6 +83,7 @@ public class ArrayOfArrayOfNumberOnly {
return Objects.hash(arrayArrayNumber); return Objects.hash(arrayArrayNumber);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -83,6 +83,7 @@ public class ArrayOfNumberOnly {
return Objects.hash(arrayNumber); return Objects.hash(arrayNumber);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -137,6 +137,7 @@ public class ArrayTest {
return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -77,6 +77,7 @@ public class Cat extends Animal {
return Objects.hash(declawed, super.hashCode()); return Objects.hash(declawed, super.hashCode());
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -97,6 +97,7 @@ public class Category {
return Objects.hash(id, name); return Objects.hash(id, name);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -75,6 +75,7 @@ public class Client {
return Objects.hash(client); return Objects.hash(client);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -77,6 +77,7 @@ public class Dog extends Animal {
return Objects.hash(breed, super.hashCode()); return Objects.hash(breed, super.hashCode());
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -164,6 +164,7 @@ public class EnumArrays {
return Objects.hash(justSymbol, arrayEnum); return Objects.hash(justSymbol, arrayEnum);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -209,6 +209,7 @@ public class EnumTest {
return Objects.hash(enumString, enumInteger, enumNumber); return Objects.hash(enumString, enumInteger, enumNumber);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -353,6 +353,7 @@ public class FormatTest {
return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -79,6 +79,7 @@ public class HasOnlyReadOnly {
return Objects.hash(bar, foo); return Objects.hash(bar, foo);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -140,6 +140,7 @@ public class MapTest {
return Objects.hash(mapMapOfString, mapOfEnumString); return Objects.hash(mapMapOfString, mapOfEnumString);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -130,6 +130,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
return Objects.hash(uuid, dateTime, map); return Objects.hash(uuid, dateTime, map);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -98,6 +98,7 @@ public class Model200Response {
return Objects.hash(name, propertyClass); return Objects.hash(name, propertyClass);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -119,6 +119,7 @@ public class ModelApiResponse {
return Objects.hash(code, type, message); return Objects.hash(code, type, message);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -76,6 +76,7 @@ public class ModelReturn {
return Objects.hash(_return); return Objects.hash(_return);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -124,6 +124,7 @@ public class Name {
return Objects.hash(name, snakeCase, property, _123Number); return Objects.hash(name, snakeCase, property, _123Number);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -76,6 +76,7 @@ public class NumberOnly {
return Objects.hash(justNumber); return Objects.hash(justNumber);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -218,6 +218,7 @@ public class Order {
return Objects.hash(id, petId, quantity, shipDate, status, complete); return Objects.hash(id, petId, quantity, shipDate, status, complete);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -231,6 +231,7 @@ public class Pet {
return Objects.hash(id, category, name, photoUrls, tags, status); return Objects.hash(id, category, name, photoUrls, tags, status);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -88,6 +88,7 @@ public class ReadOnlyFirst {
return Objects.hash(bar, baz); return Objects.hash(bar, baz);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -75,6 +75,7 @@ public class SpecialModelName {
return Objects.hash(specialPropertyName); return Objects.hash(specialPropertyName);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -97,6 +97,7 @@ public class Tag {
return Objects.hash(id, name); return Objects.hash(id, name);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -229,6 +229,7 @@ public class User {
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -62,6 +62,15 @@
*/ */
"(xyz)": "(xyz)" }; "(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; return exports;
})); }));

View File

@@ -62,6 +62,15 @@
*/ */
"(xyz)": "(xyz)" }; "(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; return exports;
})); }));

View File

@@ -123,6 +123,12 @@ Class | Method | HTTP request | Description
## Documentation For Authorization ## Documentation For Authorization
## api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
## petstore_auth ## petstore_auth
- **Type**: OAuth - **Type**: OAuth
@@ -132,12 +138,6 @@ Class | Method | HTTP request | Description
- **write:pets**: modify pets in your account - **write:pets**: modify pets in your account
- **read:pets**: read your pets - **read:pets**: read your pets
## api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
## Author ## Author

View File

@@ -31,7 +31,7 @@ Pod::Spec.new do |s|
s.resources = 'SwaggerClient/**/*.{xcdatamodeld,xcdatamodel}' s.resources = 'SwaggerClient/**/*.{xcdatamodeld,xcdatamodel}'
s.dependency 'AFNetworking', '~> 3' s.dependency 'AFNetworking', '~> 3'
s.dependency 'JSONModel', '~> 1.2' s.dependency 'JSONModel', '~> 1.4'
s.dependency 'ISO8601', '~> 0.6' s.dependency 'ISO8601', '~> 0.6'
end end

View File

@@ -352,7 +352,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]];
// Authentication setting // Authentication setting
NSArray *authSettings = @[@"petstore_auth", @"api_key"]; NSArray *authSettings = @[@"api_key", @"petstore_auth"];
id bodyParam = nil; id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];

View File

@@ -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 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. * @param querys The query parameters will be updated, passed by pointer to pointer.

View File

@@ -80,7 +80,6 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
@"application/x-www-form-urlencoded": afhttpRequestSerializer, @"application/x-www-form-urlencoded": afhttpRequestSerializer,
@"multipart/form-data": afhttpRequestSerializer @"multipart/form-data": afhttpRequestSerializer
}; };
self.securityPolicy = [self createSecurityPolicy];
self.responseSerializer = [AFHTTPResponseSerializer serializer]; self.responseSerializer = [AFHTTPResponseSerializer serializer];
} }
return self; return self;
@@ -352,25 +351,4 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth]; *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 @end

View File

@@ -75,18 +75,6 @@ static NSString * const kSWGAPIVersion = @"1.0.0";
*/ */
@property (readonly, nonatomic) BOOL debug; @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 * Authentication Settings
*/ */

View File

@@ -117,7 +117,7 @@
/** /**
* Sets the prefix for API key * Sets the prefix for API key
* *
* @param apiKeyPrefix API key prefix. * @param prefix API key prefix.
* @param identifier API key identifier. * @param identifier API key identifier.
*/ */
- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier; - (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier;
@@ -157,7 +157,7 @@
/** /**
* Removes header from defaultHeaders * Removes header from defaultHeaders
* *
* @param Header name. * @param key Header name.
*/ */
-(void) removeDefaultHeaderForKey:(NSString*)key; -(void) removeDefaultHeaderForKey:(NSString*)key;
@@ -170,7 +170,7 @@
-(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key; -(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key;
/** /**
* @param Header key name. * @param key Header key name.
*/ */
-(NSString*) defaultHeaderForKey:(NSString*)key; -(NSString*) defaultHeaderForKey:(NSString*)key;

View File

@@ -32,7 +32,6 @@
_username = @""; _username = @"";
_password = @""; _password = @"";
_accessToken= @""; _accessToken= @"";
_verifySSL = YES;
_mutableApiKey = [NSMutableDictionary dictionary]; _mutableApiKey = [NSMutableDictionary dictionary];
_mutableApiKeyPrefix = [NSMutableDictionary dictionary]; _mutableApiKeyPrefix = [NSMutableDictionary dictionary];
_mutableDefaultHeaders = [NSMutableDictionary dictionary]; _mutableDefaultHeaders = [NSMutableDictionary dictionary];
@@ -104,13 +103,6 @@
- (NSDictionary *) authSettings { - (NSDictionary *) authSettings {
return @{ return @{
@"petstore_auth":
@{
@"type": @"oauth",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getAccessToken]
},
@"api_key": @"api_key":
@{ @{
@"type": @"api_key", @"type": @"api_key",
@@ -118,6 +110,13 @@
@"key": @"api_key", @"key": @"api_key",
@"value": [self getApiKeyWithPrefix:@"api_key"] @"value": [self getApiKeyWithPrefix:@"api_key"]
}, },
@"petstore_auth":
@{
@"type": @"oauth",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getAccessToken]
},
}; };
} }

View File

@@ -50,7 +50,7 @@ extern NSInteger const SWGUnknownResponseObjectErrorCode;
* Deserializes the given data to Objective-C object. * Deserializes the given data to Objective-C object.
* *
* @param data The data will be deserialized. * @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 * @param error The error
*/ */
- (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error; - (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error;

View File

@@ -17,7 +17,7 @@
* This method is used by `JSONModel`. * This method is used by `JSONModel`.
*/ */
+ (JSONKeyMapper *)keyMapper { + (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }]; return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }];
} }
/** /**

View File

@@ -17,7 +17,7 @@
* This method is used by `JSONModel`. * This method is used by `JSONModel`.
*/ */
+ (JSONKeyMapper *)keyMapper { + (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" }];
} }
/** /**

View File

@@ -17,7 +17,7 @@
* This method is used by `JSONModel`. * This method is used by `JSONModel`.
*/ */
+ (JSONKeyMapper *)keyMapper { + (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" }];
} }
/** /**

View File

@@ -17,7 +17,7 @@
* This method is used by `JSONModel`. * This method is used by `JSONModel`.
*/ */
+ (JSONKeyMapper *)keyMapper { + (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }]; return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }];
} }
/** /**

View File

@@ -17,7 +17,7 @@
* This method is used by `JSONModel`. * This method is used by `JSONModel`.
*/ */
+ (JSONKeyMapper *)keyMapper { + (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" }];
} }
/** /**

View File

@@ -214,13 +214,15 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Example" */; buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Example" */;
buildPhases = ( buildPhases = (
841AD69C2F0A6609E3057F05 /* 📦 Check Pods Manifest.lock */,
799E7E29D924C30424DFBA28 /* [CP] Check Pods Manifest.lock */, 799E7E29D924C30424DFBA28 /* [CP] Check Pods Manifest.lock */,
6003F586195388D20070C39A /* Sources */, 6003F586195388D20070C39A /* Sources */,
6003F587195388D20070C39A /* Frameworks */, 6003F587195388D20070C39A /* Frameworks */,
6003F588195388D20070C39A /* Resources */, 6003F588195388D20070C39A /* Resources */,
429AF5C69E165ED75311B4B0 /* [CP] Copy Pods Resources */, 429AF5C69E165ED75311B4B0 /* [CP] Copy Pods Resources */,
183E54C09C54DAEB54B2546F /* [CP] Embed Pods Frameworks */, 183E54C09C54DAEB54B2546F /* [CP] Embed Pods Frameworks */,
FF3F107CF27E0A54D86C49F5 /* Embed Pods Frameworks */, FF3F107CF27E0A54D86C49F5 /* 📦 Embed Pods Frameworks */,
DA89ADFB80DCCB6691DED12D /* 📦 Copy Pods Resources */,
); );
buildRules = ( buildRules = (
); );
@@ -235,13 +237,15 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Tests" */; buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Tests" */;
buildPhases = ( buildPhases = (
E0F523B17966072A199F040E /* 📦 Check Pods Manifest.lock */,
7B069562A9F91E498732474F /* [CP] Check Pods Manifest.lock */, 7B069562A9F91E498732474F /* [CP] Check Pods Manifest.lock */,
6003F5AA195388D20070C39A /* Sources */, 6003F5AA195388D20070C39A /* Sources */,
6003F5AB195388D20070C39A /* Frameworks */, 6003F5AB195388D20070C39A /* Frameworks */,
6003F5AC195388D20070C39A /* Resources */, 6003F5AC195388D20070C39A /* Resources */,
E337D7E459CCFFDF27046FFC /* [CP] Copy Pods Resources */, E337D7E459CCFFDF27046FFC /* [CP] Copy Pods Resources */,
111D7956304BD6E860AA8709 /* [CP] Embed Pods Frameworks */, 111D7956304BD6E860AA8709 /* [CP] Embed Pods Frameworks */,
AA7CAD658C61D6EBA222B5F8 /* Embed Pods Frameworks */, AA7CAD658C61D6EBA222B5F8 /* 📦 Embed Pods Frameworks */,
E994E0232EFD15F8EE665A4D /* 📦 Copy Pods Resources */,
); );
buildRules = ( 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"; 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; showEnvVarsInLog = 0;
}; };
AA7CAD658C61D6EBA222B5F8 /* Embed Pods Frameworks */ = { 841AD69C2F0A6609E3057F05 /* 📦 Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
inputPaths = ( 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 = ( outputPaths = (
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@@ -395,6 +414,36 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests-frameworks.sh\"\n"; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests-frameworks.sh\"\n";
showEnvVarsInLog = 0; 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 */ = { E337D7E459CCFFDF27046FFC /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@@ -410,14 +459,29 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests-resources.sh\"\n"; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests-resources.sh\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
FF3F107CF27E0A54D86C49F5 /* Embed Pods Frameworks */ = { E994E0232EFD15F8EE665A4D /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
inputPaths = ( 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 = ( outputPaths = (
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;

View File

@@ -6,7 +6,6 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi
- API version: 1.0.0 - API version: 1.0.0
- Package version: - Package version:
- Build date: 2016-09-14T16:08:31.542+02:00
- Build package: class io.swagger.codegen.languages.ObjcClientCodegen - Build package: class io.swagger.codegen.languages.ObjcClientCodegen
## Requirements ## Requirements
@@ -124,6 +123,12 @@ Class | Method | HTTP request | Description
## Documentation For Authorization ## Documentation For Authorization
## api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
## petstore_auth ## petstore_auth
- **Type**: OAuth - **Type**: OAuth
@@ -133,12 +138,6 @@ Class | Method | HTTP request | Description
- **write:pets**: modify pets in your account - **write:pets**: modify pets in your account
- **read:pets**: read your pets - **read:pets**: read your pets
## api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
## Author ## Author

View File

@@ -31,7 +31,7 @@ Pod::Spec.new do |s|
s.dependency 'AFNetworking', '~> 3' s.dependency 'AFNetworking', '~> 3'
s.dependency 'JSONModel', '~> 1.2' s.dependency 'JSONModel', '~> 1.4'
s.dependency 'ISO8601', '~> 0.6' s.dependency 'ISO8601', '~> 0.6'
end end

View File

@@ -352,7 +352,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]];
// Authentication setting // Authentication setting
NSArray *authSettings = @[@"petstore_auth", @"api_key"]; NSArray *authSettings = @[@"api_key", @"petstore_auth"];
id bodyParam = nil; id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];

View File

@@ -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 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. * @param querys The query parameters will be updated, passed by pointer to pointer.

View File

@@ -117,7 +117,7 @@
/** /**
* Sets the prefix for API key * Sets the prefix for API key
* *
* @param apiKeyPrefix API key prefix. * @param prefix API key prefix.
* @param identifier API key identifier. * @param identifier API key identifier.
*/ */
- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier; - (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier;
@@ -157,7 +157,7 @@
/** /**
* Removes header from defaultHeaders * Removes header from defaultHeaders
* *
* @param Header name. * @param key Header name.
*/ */
-(void) removeDefaultHeaderForKey:(NSString*)key; -(void) removeDefaultHeaderForKey:(NSString*)key;
@@ -170,7 +170,7 @@
-(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key; -(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key;
/** /**
* @param Header key name. * @param key Header key name.
*/ */
-(NSString*) defaultHeaderForKey:(NSString*)key; -(NSString*) defaultHeaderForKey:(NSString*)key;

View File

@@ -103,13 +103,6 @@
- (NSDictionary *) authSettings { - (NSDictionary *) authSettings {
return @{ return @{
@"petstore_auth":
@{
@"type": @"oauth",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getAccessToken]
},
@"api_key": @"api_key":
@{ @{
@"type": @"api_key", @"type": @"api_key",
@@ -117,6 +110,13 @@
@"key": @"api_key", @"key": @"api_key",
@"value": [self getApiKeyWithPrefix:@"api_key"] @"value": [self getApiKeyWithPrefix:@"api_key"]
}, },
@"petstore_auth":
@{
@"type": @"oauth",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getAccessToken]
},
}; };
} }

View File

@@ -50,7 +50,7 @@ extern NSInteger const SWGUnknownResponseObjectErrorCode;
* Deserializes the given data to Objective-C object. * Deserializes the given data to Objective-C object.
* *
* @param data The data will be deserialized. * @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 * @param error The error
*/ */
- (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error; - (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error;

View File

@@ -17,7 +17,7 @@
* This method is used by `JSONModel`. * This method is used by `JSONModel`.
*/ */
+ (JSONKeyMapper *)keyMapper { + (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }]; return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }];
} }
/** /**

View File

@@ -17,7 +17,7 @@
* This method is used by `JSONModel`. * This method is used by `JSONModel`.
*/ */
+ (JSONKeyMapper *)keyMapper { + (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