mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 19:33:55 +00:00
parent
084e7f7199
commit
71c5160739
@ -7,7 +7,8 @@ import java.util.List;
|
||||
|
||||
public class CodegenParameter {
|
||||
public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
|
||||
isCookieParam, isBodyParam, isFile, notFile, hasMore, isContainer, secondaryParam, isBinary;
|
||||
isCookieParam, isBodyParam, isFile, notFile, hasMore, isContainer,
|
||||
secondaryParam, isBinary, isCollectionFormatMulti;
|
||||
public String baseName, paramName, dataType, collectionFormat, description, baseType, defaultValue;
|
||||
public String jsonSchema;
|
||||
public boolean isEnum;
|
||||
@ -33,6 +34,7 @@ public class CodegenParameter {
|
||||
output.paramName = this.paramName;
|
||||
output.dataType = this.dataType;
|
||||
output.collectionFormat = this.collectionFormat;
|
||||
output.isCollectionFormatMulti = this.isCollectionFormatMulti;
|
||||
output.description = this.description;
|
||||
output.baseType = this.baseType;
|
||||
output.isFormParam = this.isFormParam;
|
||||
|
@ -1205,6 +1205,9 @@ public class DefaultCodegen {
|
||||
p._enum = model._enum;
|
||||
p.allowableValues = model.allowableValues;
|
||||
p.collectionFormat = collectionFormat;
|
||||
if(collectionFormat != null && collectionFormat.equals("multi")) {
|
||||
p.isCollectionFormatMulti = true;
|
||||
}
|
||||
p.paramName = toParamName(qp.getName());
|
||||
|
||||
if (model.complexType != null) {
|
||||
|
@ -218,6 +218,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt"));
|
||||
} else if ("retrofit".equals(getLibrary())) {
|
||||
supportingFiles.add(new SupportingFile("auth/OAuthOkHttpClient.mustache", authFolder, "OAuthOkHttpClient.java"));
|
||||
supportingFiles.add(new SupportingFile("CollectionFormats.mustache", invokerFolder, "CollectionFormats.java"));
|
||||
} else {
|
||||
supportingFiles.add(new SupportingFile("TypeRef.mustache", invokerFolder, "TypeRef.java"));
|
||||
}
|
||||
|
@ -0,0 +1,95 @@
|
||||
package {{invokerPackage}};
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class CollectionFormats {
|
||||
|
||||
public static class CSVParams {
|
||||
|
||||
protected List<String> params;
|
||||
|
||||
public CSVParams() {
|
||||
}
|
||||
|
||||
public CSVParams(List<String> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public CSVParams(String... params) {
|
||||
this.params = Arrays.asList(params);
|
||||
}
|
||||
|
||||
public List<String> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(List<String> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.join(",", params);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class SSVParams extends CSVParams {
|
||||
|
||||
public SSVParams() {
|
||||
}
|
||||
|
||||
public SSVParams(List<String> params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public SSVParams(String... params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.join(" ", params);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TSVParams extends CSVParams {
|
||||
|
||||
public TSVParams() {
|
||||
}
|
||||
|
||||
public TSVParams(List<String> params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public TSVParams(String... params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.join("\t", params);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PIPESParams extends CSVParams {
|
||||
|
||||
public PIPESParams() {
|
||||
}
|
||||
|
||||
public PIPESParams(List<String> params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public PIPESParams(String... params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.join("|", params);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,9 @@
|
||||
package {{package}};
|
||||
|
||||
import {{invokerPackage}}.CollectionFormats.*;
|
||||
|
||||
import {{modelPackage}}.*;
|
||||
|
||||
import retrofit.Callback;
|
||||
import retrofit.http.*;
|
||||
import retrofit.mime.*;
|
||||
|
@ -1 +1 @@
|
||||
{{#isQueryParam}}@Query("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}
|
||||
{{#isQueryParam}}@Query("{{baseName}}") {{#collectionFormat}}{{#isCollectionFormatMulti}}{{{dataType}}}{{/isCollectionFormatMulti}}{{^isCollectionFormatMulti}}{{{collectionFormat.toUpperCase}}}Params{{/isCollectionFormatMulti}}{{/collectionFormat}}{{^collectionFormat}}{{{dataType}}}{{/collectionFormat}} {{paramName}}{{/isQueryParam}}
|
@ -0,0 +1,95 @@
|
||||
package io.swagger.client;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class CollectionFormats {
|
||||
|
||||
public static class CSVParams {
|
||||
|
||||
protected List<String> params;
|
||||
|
||||
public CSVParams() {
|
||||
}
|
||||
|
||||
public CSVParams(List<String> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public CSVParams(String... params) {
|
||||
this.params = Arrays.asList(params);
|
||||
}
|
||||
|
||||
public List<String> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(List<String> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.join(",", params);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class SSVParams extends CSVParams {
|
||||
|
||||
public SSVParams() {
|
||||
}
|
||||
|
||||
public SSVParams(List<String> params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public SSVParams(String... params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.join(" ", params);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TSVParams extends CSVParams {
|
||||
|
||||
public TSVParams() {
|
||||
}
|
||||
|
||||
public TSVParams(List<String> params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public TSVParams(String... params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.join("\t", params);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PIPESParams extends CSVParams {
|
||||
|
||||
public PIPESParams() {
|
||||
}
|
||||
|
||||
public PIPESParams(List<String> params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public PIPESParams(String... params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.join("|", params);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-09-18T14:07:38.326+02:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-11T00:10:38.251+02:00")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
|
@ -1,5 +1,9 @@
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.client.CollectionFormats.*;
|
||||
|
||||
import io.swagger.client.model.*;
|
||||
|
||||
import retrofit.Callback;
|
||||
import retrofit.http.*;
|
||||
import retrofit.mime.*;
|
||||
|
@ -1,5 +1,9 @@
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.client.CollectionFormats.*;
|
||||
|
||||
import io.swagger.client.model.*;
|
||||
|
||||
import retrofit.Callback;
|
||||
import retrofit.http.*;
|
||||
import retrofit.mime.*;
|
||||
|
@ -1,5 +1,9 @@
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.client.CollectionFormats.*;
|
||||
|
||||
import io.swagger.client.model.*;
|
||||
|
||||
import retrofit.Callback;
|
||||
import retrofit.http.*;
|
||||
import retrofit.mime.*;
|
||||
|
Loading…
Reference in New Issue
Block a user