[Java][native][apache-httpclient] Update toUrlQueryString to support form style for object (#14478)

* update toUrlQueryString

* add new files

* minor bug fixes

* support object in query parameter - java apache httpclient

* rename variable - java native

* update samples

* fix try catch
This commit is contained in:
William Cheng
2023-01-19 16:13:51 +08:00
committed by GitHub
parent d1cde7febe
commit 6cd7989e9e
228 changed files with 8867 additions and 688 deletions

View File

@@ -17,6 +17,7 @@ import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Pair;
import org.openapitools.client.model.DataQuery;
import org.openapitools.client.model.Pet;
import org.openapitools.client.model.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter;
import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter;
@@ -143,7 +144,7 @@ public class QueryApi {
String localVarPath = "/query/integer/boolean/string";
List<Pair> localVarQueryParams = new ArrayList<>();
StringJoiner localVarQueryDeepObjectStringJoiner = new StringJoiner("&");
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "integer_query";
localVarQueryParams.addAll(ApiClient.parameterToPairs("integer_query", integerQuery));
@@ -152,11 +153,11 @@ public class QueryApi {
localVarQueryParameterBaseName = "string_query";
localVarQueryParams.addAll(ApiClient.parameterToPairs("string_query", stringQuery));
if (!localVarQueryParams.isEmpty() || localVarQueryDeepObjectStringJoiner.length() != 0) {
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
if (localVarQueryDeepObjectStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryDeepObjectStringJoiner.toString());
if (localVarQueryStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryStringJoiner.toString());
}
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
@@ -237,18 +238,18 @@ public class QueryApi {
String localVarPath = "/query/style_deepObject/explode_true/object";
List<Pair> localVarQueryParams = new ArrayList<>();
StringJoiner localVarQueryDeepObjectStringJoiner = new StringJoiner("&");
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "query_object";
if (queryObject != null) {
localVarQueryDeepObjectStringJoiner.add(queryObject.toUrlQueryString("query_object"));
localVarQueryStringJoiner.add(queryObject.toUrlQueryString("query_object"));
}
if (!localVarQueryParams.isEmpty() || localVarQueryDeepObjectStringJoiner.length() != 0) {
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
if (localVarQueryDeepObjectStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryDeepObjectStringJoiner.toString());
if (localVarQueryStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryStringJoiner.toString());
}
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
@@ -329,18 +330,18 @@ public class QueryApi {
String localVarPath = "/query/style_deepObject/explode_true/object/allOf";
List<Pair> localVarQueryParams = new ArrayList<>();
StringJoiner localVarQueryDeepObjectStringJoiner = new StringJoiner("&");
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "query_object";
if (queryObject != null) {
localVarQueryDeepObjectStringJoiner.add(queryObject.toUrlQueryString("query_object"));
localVarQueryStringJoiner.add(queryObject.toUrlQueryString("query_object"));
}
if (!localVarQueryParams.isEmpty() || localVarQueryDeepObjectStringJoiner.length() != 0) {
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
if (localVarQueryDeepObjectStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryDeepObjectStringJoiner.toString());
if (localVarQueryStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryStringJoiner.toString());
}
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
@@ -421,16 +422,16 @@ public class QueryApi {
String localVarPath = "/query/style_form/explode_true/array_string";
List<Pair> localVarQueryParams = new ArrayList<>();
StringJoiner localVarQueryDeepObjectStringJoiner = new StringJoiner("&");
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "query_object";
localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "values", queryObject.getValues()));
if (!localVarQueryParams.isEmpty() || localVarQueryDeepObjectStringJoiner.length() != 0) {
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
if (localVarQueryDeepObjectStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryDeepObjectStringJoiner.toString());
if (localVarQueryStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryStringJoiner.toString());
}
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
@@ -511,7 +512,7 @@ public class QueryApi {
String localVarPath = "/query/style_form/explode_true/object";
List<Pair> localVarQueryParams = new ArrayList<>();
StringJoiner localVarQueryDeepObjectStringJoiner = new StringJoiner("&");
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "query_object";
localVarQueryParams.addAll(ApiClient.parameterToPairs("id", queryObject.getId()));
@@ -521,11 +522,101 @@ public class QueryApi {
localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "tags", queryObject.getTags()));
localVarQueryParams.addAll(ApiClient.parameterToPairs("status", queryObject.getStatus()));
if (!localVarQueryParams.isEmpty() || localVarQueryDeepObjectStringJoiner.length() != 0) {
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
if (localVarQueryDeepObjectStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryDeepObjectStringJoiner.toString());
if (localVarQueryStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryStringJoiner.toString());
}
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "text/plain");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @return String
* @throws ApiException if fails to make API call
*/
public String testQueryStyleFormExplodeTrueObjectAllOf(DataQuery queryObject) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject);
return localVarResponse.getData();
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(DataQuery queryObject) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeTrueObjectAllOfRequestBuilder(queryObject);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("testQueryStyleFormExplodeTrueObjectAllOf", localVarResponse);
}
// for plain text response
if (localVarResponse.headers().map().containsKey("Content-Type") &&
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
String responseBodyText = s.hasNext() ? s.next() : "";
return new ApiResponse<String>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
responseBodyText
);
} else {
throw new RuntimeException("Error! The response Content-Type is supposed to be `text/plain` but it's not: " + localVarResponse);
}
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectAllOfRequestBuilder(DataQuery queryObject) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/query/style_form/explode_true/object/allOf";
List<Pair> localVarQueryParams = new ArrayList<>();
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "query_object";
localVarQueryStringJoiner.add(queryObject.toUrlQueryString(null));
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
if (localVarQueryStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryStringJoiner.toString());
}
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {

View File

@@ -138,6 +138,15 @@ public class Bird {
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
@@ -145,20 +154,30 @@ public class Bird {
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `size` to the URL query string
if (getSize() != null) {
joiner.add(String.format("%s[size]=%s", prefix, URLEncoder.encode(String.valueOf(getSize()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%ssize%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSize()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `color` to the URL query string
if (getColor() != null) {
joiner.add(String.format("%s[color]=%s", prefix, URLEncoder.encode(String.valueOf(getColor()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%scolor%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getColor()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();

View File

@@ -138,6 +138,15 @@ public class Category {
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
@@ -145,20 +154,30 @@ public class Category {
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%s[id]=%s", prefix, URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%s[name]=%s", prefix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();

View File

@@ -0,0 +1,242 @@
/*
* Echo Server API
* Echo Server API
*
* The version of the OpenAPI document: 0.1.0
* Contact: team@openapitools.org
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Query;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* DataQuery
*/
@JsonPropertyOrder({
DataQuery.JSON_PROPERTY_SUFFIX,
DataQuery.JSON_PROPERTY_TEXT,
DataQuery.JSON_PROPERTY_DATE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class DataQuery extends Query {
public static final String JSON_PROPERTY_SUFFIX = "suffix";
private String suffix;
public static final String JSON_PROPERTY_TEXT = "text";
private String text;
public static final String JSON_PROPERTY_DATE = "date";
private OffsetDateTime date;
public DataQuery() {
}
public DataQuery suffix(String suffix) {
this.suffix = suffix;
return this;
}
/**
* test suffix
* @return suffix
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SUFFIX)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getSuffix() {
return suffix;
}
@JsonProperty(JSON_PROPERTY_SUFFIX)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSuffix(String suffix) {
this.suffix = suffix;
}
public DataQuery text(String text) {
this.text = text;
return this;
}
/**
* Some text containing white spaces
* @return text
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_TEXT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getText() {
return text;
}
@JsonProperty(JSON_PROPERTY_TEXT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setText(String text) {
this.text = text;
}
public DataQuery date(OffsetDateTime date) {
this.date = date;
return this;
}
/**
* A date
* @return date
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public OffsetDateTime getDate() {
return date;
}
@JsonProperty(JSON_PROPERTY_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setDate(OffsetDateTime date) {
this.date = date;
}
/**
* Return true if this DataQuery object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DataQuery dataQuery = (DataQuery) o;
return Objects.equals(this.suffix, dataQuery.suffix) &&
Objects.equals(this.text, dataQuery.text) &&
Objects.equals(this.date, dataQuery.date) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(suffix, text, date, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DataQuery {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" suffix: ").append(toIndentedString(suffix)).append("\n");
sb.append(" text: ").append(toIndentedString(text)).append("\n");
sb.append(" date: ").append(toIndentedString(date)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `suffix` to the URL query string
if (getSuffix() != null) {
joiner.add(String.format("%ssuffix%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSuffix()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `text` to the URL query string
if (getText() != null) {
joiner.add(String.format("%stext%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getText()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `date` to the URL query string
if (getDate() != null) {
joiner.add(String.format("%sdate%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getDate()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `outcomes` to the URL query string
if (getOutcomes() != null) {
for (int i = 0; i < getOutcomes().size(); i++) {
joiner.add(String.format("%soutcomes%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getOutcomes().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,223 @@
/*
* Echo Server API
* Echo Server API
*
* The version of the OpenAPI document: 0.1.0
* Contact: team@openapitools.org
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.OffsetDateTime;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* DataQueryAllOf
*/
@JsonPropertyOrder({
DataQueryAllOf.JSON_PROPERTY_SUFFIX,
DataQueryAllOf.JSON_PROPERTY_TEXT,
DataQueryAllOf.JSON_PROPERTY_DATE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class DataQueryAllOf {
public static final String JSON_PROPERTY_SUFFIX = "suffix";
private String suffix;
public static final String JSON_PROPERTY_TEXT = "text";
private String text;
public static final String JSON_PROPERTY_DATE = "date";
private OffsetDateTime date;
public DataQueryAllOf() {
}
public DataQueryAllOf suffix(String suffix) {
this.suffix = suffix;
return this;
}
/**
* test suffix
* @return suffix
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SUFFIX)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getSuffix() {
return suffix;
}
@JsonProperty(JSON_PROPERTY_SUFFIX)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSuffix(String suffix) {
this.suffix = suffix;
}
public DataQueryAllOf text(String text) {
this.text = text;
return this;
}
/**
* Some text containing white spaces
* @return text
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_TEXT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getText() {
return text;
}
@JsonProperty(JSON_PROPERTY_TEXT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setText(String text) {
this.text = text;
}
public DataQueryAllOf date(OffsetDateTime date) {
this.date = date;
return this;
}
/**
* A date
* @return date
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public OffsetDateTime getDate() {
return date;
}
@JsonProperty(JSON_PROPERTY_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setDate(OffsetDateTime date) {
this.date = date;
}
/**
* Return true if this DataQuery_allOf object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DataQueryAllOf dataQueryAllOf = (DataQueryAllOf) o;
return Objects.equals(this.suffix, dataQueryAllOf.suffix) &&
Objects.equals(this.text, dataQueryAllOf.text) &&
Objects.equals(this.date, dataQueryAllOf.date);
}
@Override
public int hashCode() {
return Objects.hash(suffix, text, date);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DataQueryAllOf {\n");
sb.append(" suffix: ").append(toIndentedString(suffix)).append("\n");
sb.append(" text: ").append(toIndentedString(text)).append("\n");
sb.append(" date: ").append(toIndentedString(date)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `suffix` to the URL query string
if (getSuffix() != null) {
joiner.add(String.format("%ssuffix%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSuffix()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `text` to the URL query string
if (getText() != null) {
joiner.add(String.format("%stext%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getText()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `date` to the URL query string
if (getDate() != null) {
joiner.add(String.format("%sdate%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getDate()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -316,6 +316,15 @@ public class Pet {
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
@@ -323,31 +332,43 @@ public class Pet {
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%s[id]=%s", prefix, URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%s[name]=%s", prefix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `category` to the URL query string
if (getCategory() != null) {
joiner.add(getCategory().toUrlQueryString(prefix + "[category]"));
joiner.add(getCategory().toUrlQueryString(prefix + "category" + suffix));
}
// add `photoUrls` to the URL query string
if (getPhotoUrls() != null) {
for (int i = 0; i < getPhotoUrls().size(); i++) {
joiner.add(String.format("%s[photoUrls][%d]=%s", prefix, i, URLEncoder.encode(String.valueOf(getPhotoUrls().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%sphotoUrls%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getPhotoUrls().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}
@@ -355,14 +376,15 @@ public class Pet {
if (getTags() != null) {
for (int i = 0; i < getTags().size(); i++) {
if (getTags().get(i) != null) {
joiner.add(getTags().get(i).toUrlQueryString(String.format("%s[tags][%d]", prefix, i)));
joiner.add(getTags().get(i).toUrlQueryString(String.format("%stags%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
// add `status` to the URL query string
if (getStatus() != null) {
joiner.add(String.format("%s[status]=%s", prefix, URLEncoder.encode(String.valueOf(getStatus()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%sstatus%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getStatus()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();

View File

@@ -0,0 +1,237 @@
/*
* Echo Server API
* Echo Server API
*
* The version of the OpenAPI document: 0.1.0
* Contact: team@openapitools.org
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* Query
*/
@JsonPropertyOrder({
Query.JSON_PROPERTY_ID,
Query.JSON_PROPERTY_OUTCOMES
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Query {
public static final String JSON_PROPERTY_ID = "id";
private Long id;
/**
* Gets or Sets outcomes
*/
public enum OutcomesEnum {
SUCCESS("SUCCESS"),
FAILURE("FAILURE"),
SKIPPED("SKIPPED");
private String value;
OutcomesEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static OutcomesEnum fromValue(String value) {
for (OutcomesEnum b : OutcomesEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
public static final String JSON_PROPERTY_OUTCOMES = "outcomes";
private List<OutcomesEnum> outcomes = null;
public Query() {
}
public Query id(Long id) {
this.id = id;
return this;
}
/**
* Query
* @return id
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Long getId() {
return id;
}
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setId(Long id) {
this.id = id;
}
public Query outcomes(List<OutcomesEnum> outcomes) {
this.outcomes = outcomes;
return this;
}
public Query addOutcomesItem(OutcomesEnum outcomesItem) {
if (this.outcomes == null) {
this.outcomes = new ArrayList<>();
}
this.outcomes.add(outcomesItem);
return this;
}
/**
* Get outcomes
* @return outcomes
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_OUTCOMES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<OutcomesEnum> getOutcomes() {
return outcomes;
}
@JsonProperty(JSON_PROPERTY_OUTCOMES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setOutcomes(List<OutcomesEnum> outcomes) {
this.outcomes = outcomes;
}
/**
* Return true if this Query object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Query query = (Query) o;
return Objects.equals(this.id, query.id) &&
Objects.equals(this.outcomes, query.outcomes);
}
@Override
public int hashCode() {
return Objects.hash(id, outcomes);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Query {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" outcomes: ").append(toIndentedString(outcomes)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `outcomes` to the URL query string
if (getOutcomes() != null) {
for (int i = 0; i < getOutcomes().size(); i++) {
joiner.add(String.format("%soutcomes%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getOutcomes().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}
return joiner.toString();
}
}

View File

@@ -138,6 +138,15 @@ public class Tag {
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
@@ -145,20 +154,30 @@ public class Tag {
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%s[id]=%s", prefix, URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%s[name]=%s", prefix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();

View File

@@ -200,6 +200,15 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
@@ -207,30 +216,40 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `size` to the URL query string
if (getSize() != null) {
joiner.add(String.format("%s[size]=%s", prefix, URLEncoder.encode(String.valueOf(getSize()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%ssize%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSize()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `color` to the URL query string
if (getColor() != null) {
joiner.add(String.format("%s[color]=%s", prefix, URLEncoder.encode(String.valueOf(getColor()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%scolor%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getColor()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%s[id]=%s", prefix, URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%s[name]=%s", prefix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();

View File

@@ -117,6 +117,15 @@ public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
@@ -124,8 +133,18 @@ public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
@@ -133,7 +152,9 @@ public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
// add `values` to the URL query string
if (getValues() != null) {
for (int i = 0; i < getValues().size(); i++) {
joiner.add(String.format("%s[values][%d]=%s", prefix, i, URLEncoder.encode(String.valueOf(getValues().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%svalues%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getValues().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}

View File

@@ -0,0 +1,239 @@
/*
* Echo Server API
* Echo Server API
*
* The version of the OpenAPI document: 0.1.0
* Contact: team@openapitools.org
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter
*/
@JsonPropertyOrder({
TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter.JSON_PROPERTY_SIZE,
TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter.JSON_PROPERTY_COLOR,
TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter.JSON_PROPERTY_ID,
TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter.JSON_PROPERTY_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter {
public static final String JSON_PROPERTY_SIZE = "size";
private String size;
public static final String JSON_PROPERTY_COLOR = "color";
private String color;
public static final String JSON_PROPERTY_ID = "id";
private Long id;
public static final String JSON_PROPERTY_NAME = "name";
private String name;
public TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter() {
}
public TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter size(String size) {
this.size = size;
return this;
}
/**
* Get size
* @return size
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SIZE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getSize() {
return size;
}
@JsonProperty(JSON_PROPERTY_SIZE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSize(String size) {
this.size = size;
}
public TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter color(String color) {
this.color = color;
return this;
}
/**
* Get color
* @return color
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_COLOR)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getColor() {
return color;
}
@JsonProperty(JSON_PROPERTY_COLOR)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setColor(String color) {
this.color = color;
}
public TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter id(Long id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Long getId() {
return id;
}
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setId(Long id) {
this.id = id;
}
public TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter name(String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getName() {
return name;
}
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setName(String name) {
this.name = name;
}
/**
* Return true if this test_query_style_form_explode_true_object_allOf_query_object_parameter object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter testQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter = (TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter) o;
return Objects.equals(this.size, testQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter.size) &&
Objects.equals(this.color, testQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter.color) &&
Objects.equals(this.id, testQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter.id) &&
Objects.equals(this.name, testQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter.name);
}
@Override
public int hashCode() {
return Objects.hash(size, color, id, name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter {\n");
sb.append(" size: ").append(toIndentedString(size)).append("\n");
sb.append(" color: ").append(toIndentedString(color)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
if (prefix == null) {
prefix = "";
}
StringJoiner joiner = new StringJoiner("&");
// add `size` to the URL query string
if (getSize() != null) {
joiner.add(String.format("%s[size]=%s", prefix, URLEncoder.encode(String.valueOf(getSize()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `color` to the URL query string
if (getColor() != null) {
joiner.add(String.format("%s[color]=%s", prefix, URLEncoder.encode(String.valueOf(getColor()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%s[id]=%s", prefix, URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%s[name]=%s", prefix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -71,6 +71,24 @@ public class CustomTest {
Assert.assertEquals("/query/style_form/explode_true/object?id=12345&name=Hello%20World&category=class%20Category%20%7B%0A%20%20%20%20id%3A%20987%0A%20%20%20%20name%3A%20new%20category%0A%7D&photoUrls=http%3A%2F%2Fa.com&photoUrls=http%3A%2F%2Fb.com", p.path);
}
/**
* Test query parameter(s)
* <p>
* Test query parameter(s)
*
* @throws ApiException if the Api call fails
*/
@Test
public void testQueryStyleFormExplodeTrueObjectAllOfTest() throws ApiException {
DataQuery queryObject = new DataQuery().text("Hello World");
queryObject.setId(3487L);
queryObject.setOutcomes(Arrays.asList(Query.OutcomesEnum.SKIPPED, Query.OutcomesEnum.FAILURE));
String response = api.testQueryStyleFormExplodeTrueObjectAllOf(queryObject);
org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser(response);
Assert.assertEquals("/query/style_form/explode_true/object/allOf?text=Hello%20World&id=3487&outcomes=SKIPPED&outcomes=FAILURE", p.path);
}
/**
* Test query parameter(s)
* <p>

View File

@@ -0,0 +1,57 @@
/*
* Echo Server API
* Echo Server API
*
* The version of the OpenAPI document: 0.1.0
* Contact: team@openapitools.org
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.OffsetDateTime;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for DataQueryAllOf
*/
public class DataQueryAllOfTest {
private final DataQueryAllOf model = new DataQueryAllOf();
/**
* Model tests for DataQueryAllOf
*/
@Test
public void testDataQueryAllOf() {
// TODO: test DataQueryAllOf
}
/**
* Test the property 'text'
*/
@Test
public void textTest() {
// TODO: test text
}
/**
* Test the property 'date'
*/
@Test
public void dateTest() {
// TODO: test date
}
}

View File

@@ -0,0 +1,76 @@
/*
* Echo Server API
* Echo Server API
*
* The version of the OpenAPI document: 0.1.0
* Contact: team@openapitools.org
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Query;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for DataQuery
*/
public class DataQueryTest {
private final DataQuery model = new DataQuery();
/**
* Model tests for DataQuery
*/
@Test
public void testDataQuery() {
// TODO: test DataQuery
}
/**
* Test the property 'text'
*/
@Test
public void textTest() {
// TODO: test text
}
/**
* Test the property 'date'
*/
@Test
public void dateTest() {
// TODO: test date
}
/**
* Test the property 'id'
*/
@Test
public void idTest() {
// TODO: test id
}
/**
* Test the property 'outcomes'
*/
@Test
public void outcomesTest() {
// TODO: test outcomes
}
}

View File

@@ -0,0 +1,58 @@
/*
* Echo Server API
* Echo Server API
*
* The version of the OpenAPI document: 0.1.0
* Contact: team@openapitools.org
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Query
*/
public class QueryTest {
private final Query model = new Query();
/**
* Model tests for Query
*/
@Test
public void testQuery() {
// TODO: test Query
}
/**
* Test the property 'id'
*/
@Test
public void idTest() {
// TODO: test id
}
/**
* Test the property 'outcomes'
*/
@Test
public void outcomesTest() {
// TODO: test outcomes
}
}

View File

@@ -0,0 +1,72 @@
/*
* Echo Server API
* Echo Server API
*
* The version of the OpenAPI document: 0.1.0
* Contact: team@openapitools.org
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter
*/
public class TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameterTest {
private final TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter model = new TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter();
/**
* Model tests for TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter
*/
@Test
public void testTestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter() {
// TODO: test TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameter
}
/**
* Test the property 'size'
*/
@Test
public void sizeTest() {
// TODO: test size
}
/**
* Test the property 'color'
*/
@Test
public void colorTest() {
// TODO: test color
}
/**
* Test the property 'id'
*/
@Test
public void idTest() {
// TODO: test id
}
/**
* Test the property 'name'
*/
@Test
public void nameTest() {
// TODO: test name
}
}