Skip to content

Commit

Permalink
fix serialization of OffsetDateTime
Browse files Browse the repository at this point in the history
  • Loading branch information
MachineUserPTV committed May 21, 2024
1 parent 0a84441 commit c8154f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class ApiClient {
private Duration readTimeout;
private Duration connectTimeout;
private static String valueToString(Object value) {
public static String valueToString(Object value) {
if (value == null) {
return "";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{#discriminator}}
import {{invokerPackage}}.JSON;
{{/discriminator}}
import {{invokerPackage}}.ApiClient;
/**
* {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}}
* @deprecated{{/isDeprecated}}
Expand Down Expand Up @@ -408,7 +409,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
for ({{{items.dataType}}} _item : {{getter}}()) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
URLEncoder.encode(ApiClient.valueToString(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
i++;
}
Expand All @@ -418,7 +419,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
for (int i = 0; i < {{getter}}().size(); i++) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
URLEncoder.encode(ApiClient.valueToString({{getter}}().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}
{{/uniqueItems}}
Expand Down Expand Up @@ -456,7 +457,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if (_item != null) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
URLEncoder.encode(ApiClient.valueToString(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
i++;
}
Expand All @@ -468,7 +469,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}().get(i) != null) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
URLEncoder.encode(ApiClient.valueToString({{getter}}().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}
}
Expand All @@ -483,7 +484,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
for (String _key : {{getter}}().keySet()) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
{{getter}}().get(_key), URLEncoder.encode(String.valueOf({{getter}}().get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
{{getter}}().get(_key), URLEncoder.encode(ApiClient.valueToString({{getter}}().get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}
{{/items.isModel}}
Expand All @@ -501,7 +502,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{^isMap}}
{{#isPrimitiveType}}
if ({{getter}}() != null) {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString({{{getter}}}()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
Expand All @@ -512,7 +513,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{/isModel}}
{{^isModel}}
if ({{getter}}() != null) {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString({{{getter}}}()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
{{/isModel}}
{{/isPrimitiveType}}
Expand Down

0 comments on commit c8154f2

Please sign in to comment.