mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-21 08:57:08 +00:00
[Java] Use Fully Qualified Name for java.util.Locale in Generated Classes (#22342)
* Remove Imports of `Locale` from all `model.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `modelEnum.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `oneof_model.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `api.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `anyof_model.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `pojo.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `ApiClient.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `ApiKeyAuth.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `JSON.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `HttpSignatureAuth.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `Play24CallFactory.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `Play25CallFactory.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `Play26CallFactory.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `apiException.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `clientConfiguration.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `RequestFactory.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `httpLoggingFilter.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `securityApiUtils.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Remove Imports of `Locale` from all `validatorUtils.mustache`-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Use `Locale`-class Via Fully Qualified Name Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated 'sample'-files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Revert Changes * Inline `Locale` Imports Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated 'source' Files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update `kotlin-spring/model.mustache` Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated 'sample' Files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated 'sample' Files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated 'java-feign-hc5' Sample Files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Sample Files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Kotlin Sample Files Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> --------- Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
e1edb9e645
commit
149fdcb61f
@@ -1325,7 +1325,7 @@ public class ApiClient {
|
||||
if (serverIndex != null) {
|
||||
if (serverIndex < 0 || serverIndex >= servers.size()) {
|
||||
throw new ArrayIndexOutOfBoundsException(String.format(
|
||||
Locale.ROOT,
|
||||
java.util.Locale.ROOT,
|
||||
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
|
||||
));
|
||||
}
|
||||
@@ -1398,11 +1398,11 @@ public class ApiClient {
|
||||
*/
|
||||
public void processCookieParams(Map<String, String> cookieParams, Request.Builder reqBuilder) {
|
||||
for (Entry<String, String> param : cookieParams.entrySet()) {
|
||||
reqBuilder.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", param.getKey(), param.getValue()));
|
||||
reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue()));
|
||||
}
|
||||
for (Entry<String, String> param : defaultCookieMap.entrySet()) {
|
||||
if (!cookieParams.containsKey(param.getKey())) {
|
||||
reqBuilder.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", param.getKey(), param.getValue()));
|
||||
reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ package org.openapitools.client;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
/**
|
||||
@@ -162,7 +161,7 @@ public class ApiException extends Exception {
|
||||
* @return The exception message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return String.format(Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s",
|
||||
return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s",
|
||||
super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@@ -43,7 +42,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.openapitools.client.JSON;
|
||||
|
||||
@@ -164,7 +162,7 @@ public class Bird {
|
||||
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
|
||||
if (jsonElement == null) {
|
||||
if (!Bird.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Bird is not found in the empty JSON string", Bird.openapiRequiredFields.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Bird is not found in the empty JSON string", Bird.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,15 +170,15 @@ public class Bird {
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Map.Entry<String, JsonElement> entry : entries) {
|
||||
if (!Bird.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Bird` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Bird` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
if ((jsonObj.get("size") != null && !jsonObj.get("size").isJsonNull()) && !jsonObj.get("size").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `size` to be a primitive type in the JSON string but got `%s`", jsonObj.get("size").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `size` to be a primitive type in the JSON string but got `%s`", jsonObj.get("size").toString()));
|
||||
}
|
||||
if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@@ -43,7 +42,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.openapitools.client.JSON;
|
||||
|
||||
@@ -164,7 +162,7 @@ public class Category {
|
||||
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
|
||||
if (jsonElement == null) {
|
||||
if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,12 +170,12 @@ public class Category {
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Map.Entry<String, JsonElement> entry : entries) {
|
||||
if (!Category.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Category` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Category` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@@ -47,7 +46,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.openapitools.client.JSON;
|
||||
|
||||
@@ -196,7 +194,7 @@ public class DataQuery extends Query {
|
||||
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
|
||||
if (jsonElement == null) {
|
||||
if (!DataQuery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in DataQuery is not found in the empty JSON string", DataQuery.openapiRequiredFields.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in DataQuery is not found in the empty JSON string", DataQuery.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,15 +202,15 @@ public class DataQuery extends Query {
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Map.Entry<String, JsonElement> entry : entries) {
|
||||
if (!DataQuery.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `DataQuery` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `DataQuery` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
if ((jsonObj.get("suffix") != null && !jsonObj.get("suffix").isJsonNull()) && !jsonObj.get("suffix").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `suffix` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suffix").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `suffix` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suffix").toString()));
|
||||
}
|
||||
if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@@ -47,7 +46,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.openapitools.client.JSON;
|
||||
|
||||
@@ -445,7 +443,7 @@ public class DefaultValue {
|
||||
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
|
||||
if (jsonElement == null) {
|
||||
if (!DefaultValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in DefaultValue is not found in the empty JSON string", DefaultValue.openapiRequiredFields.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in DefaultValue is not found in the empty JSON string", DefaultValue.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,40 +451,40 @@ public class DefaultValue {
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Map.Entry<String, JsonElement> entry : entries) {
|
||||
if (!DefaultValue.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `DefaultValue` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `DefaultValue` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
// ensure the optional json data is an array if present
|
||||
if (jsonObj.get("array_string_enum_ref_default") != null && !jsonObj.get("array_string_enum_ref_default").isJsonNull() && !jsonObj.get("array_string_enum_ref_default").isJsonArray()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `array_string_enum_ref_default` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_enum_ref_default").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_string_enum_ref_default` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_enum_ref_default").toString()));
|
||||
}
|
||||
// ensure the optional json data is an array if present
|
||||
if (jsonObj.get("array_string_enum_default") != null && !jsonObj.get("array_string_enum_default").isJsonNull() && !jsonObj.get("array_string_enum_default").isJsonArray()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `array_string_enum_default` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_enum_default").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_string_enum_default` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_enum_default").toString()));
|
||||
}
|
||||
// ensure the optional json data is an array if present
|
||||
if (jsonObj.get("array_string_default") != null && !jsonObj.get("array_string_default").isJsonNull() && !jsonObj.get("array_string_default").isJsonArray()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `array_string_default` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_default").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_string_default` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_default").toString()));
|
||||
}
|
||||
// ensure the optional json data is an array if present
|
||||
if (jsonObj.get("array_integer_default") != null && !jsonObj.get("array_integer_default").isJsonNull() && !jsonObj.get("array_integer_default").isJsonArray()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `array_integer_default` to be an array in the JSON string but got `%s`", jsonObj.get("array_integer_default").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_integer_default` to be an array in the JSON string but got `%s`", jsonObj.get("array_integer_default").toString()));
|
||||
}
|
||||
// ensure the optional json data is an array if present
|
||||
if (jsonObj.get("array_string") != null && !jsonObj.get("array_string").isJsonNull() && !jsonObj.get("array_string").isJsonArray()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `array_string` to be an array in the JSON string but got `%s`", jsonObj.get("array_string").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_string` to be an array in the JSON string but got `%s`", jsonObj.get("array_string").toString()));
|
||||
}
|
||||
// ensure the optional json data is an array if present
|
||||
if (jsonObj.get("array_string_nullable") != null && !jsonObj.get("array_string_nullable").isJsonNull() && !jsonObj.get("array_string_nullable").isJsonArray()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `array_string_nullable` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_nullable").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_string_nullable` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_nullable").toString()));
|
||||
}
|
||||
// ensure the optional json data is an array if present
|
||||
if (jsonObj.get("array_string_extension_nullable") != null && !jsonObj.get("array_string_extension_nullable").isJsonNull() && !jsonObj.get("array_string_extension_nullable").isJsonArray()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `array_string_extension_nullable` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_extension_nullable").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_string_extension_nullable` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_extension_nullable").toString()));
|
||||
}
|
||||
if ((jsonObj.get("string_nullable") != null && !jsonObj.get("string_nullable").isJsonNull()) && !jsonObj.get("string_nullable").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `string_nullable` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_nullable").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `string_nullable` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_nullable").toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@@ -44,7 +43,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.openapitools.client.JSON;
|
||||
|
||||
@@ -193,7 +191,7 @@ public class NumberPropertiesOnly {
|
||||
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
|
||||
if (jsonElement == null) {
|
||||
if (!NumberPropertiesOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in NumberPropertiesOnly is not found in the empty JSON string", NumberPropertiesOnly.openapiRequiredFields.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NumberPropertiesOnly is not found in the empty JSON string", NumberPropertiesOnly.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +199,7 @@ public class NumberPropertiesOnly {
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Map.Entry<String, JsonElement> entry : entries) {
|
||||
if (!NumberPropertiesOnly.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `NumberPropertiesOnly` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `NumberPropertiesOnly` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@@ -47,7 +46,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.openapitools.client.JSON;
|
||||
|
||||
@@ -342,7 +340,7 @@ public class Pet {
|
||||
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
|
||||
if (jsonElement == null) {
|
||||
if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,19 +348,19 @@ public class Pet {
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Map.Entry<String, JsonElement> entry : entries) {
|
||||
if (!Pet.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Pet` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Pet` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
// check to make sure all required properties/fields are present in the JSON string
|
||||
for (String requiredField : Pet.openapiRequiredFields) {
|
||||
if (jsonElement.getAsJsonObject().get(requiredField) == null) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
if (!jsonObj.get("name").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
}
|
||||
// validate the optional field `category`
|
||||
if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) {
|
||||
@@ -372,14 +370,14 @@ public class Pet {
|
||||
if (jsonObj.get("photoUrls") == null) {
|
||||
throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`");
|
||||
} else if (!jsonObj.get("photoUrls").isJsonArray()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString()));
|
||||
}
|
||||
if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) {
|
||||
JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags");
|
||||
if (jsonArraytags != null) {
|
||||
// ensure the json data is an array
|
||||
if (!jsonObj.get("tags").isJsonArray()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString()));
|
||||
}
|
||||
|
||||
// validate the optional field `tags` (array)
|
||||
@@ -389,7 +387,7 @@ public class Pet {
|
||||
}
|
||||
}
|
||||
if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString()));
|
||||
}
|
||||
// validate the optional field `status`
|
||||
if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@@ -45,7 +44,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.openapitools.client.JSON;
|
||||
|
||||
@@ -228,13 +226,13 @@ public class Query {
|
||||
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
|
||||
if (jsonElement == null) {
|
||||
if (!Query.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Query is not found in the empty JSON string", Query.openapiRequiredFields.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Query is not found in the empty JSON string", Query.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
// ensure the optional json data is an array if present
|
||||
if (jsonObj.get("outcomes") != null && !jsonObj.get("outcomes").isJsonNull() && !jsonObj.get("outcomes").isJsonArray()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `outcomes` to be an array in the JSON string but got `%s`", jsonObj.get("outcomes").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `outcomes` to be an array in the JSON string but got `%s`", jsonObj.get("outcomes").toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,9 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@@ -43,7 +42,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.openapitools.client.JSON;
|
||||
|
||||
@@ -164,7 +162,7 @@ public class Tag {
|
||||
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
|
||||
if (jsonElement == null) {
|
||||
if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,12 +170,12 @@ public class Tag {
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Map.Entry<String, JsonElement> entry : entries) {
|
||||
if (!Tag.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Tag` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Tag` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@@ -43,7 +42,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.openapitools.client.JSON;
|
||||
|
||||
@@ -138,7 +136,7 @@ public class TestFormObjectMultipartRequestMarker {
|
||||
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
|
||||
if (jsonElement == null) {
|
||||
if (!TestFormObjectMultipartRequestMarker.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in TestFormObjectMultipartRequestMarker is not found in the empty JSON string", TestFormObjectMultipartRequestMarker.openapiRequiredFields.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TestFormObjectMultipartRequestMarker is not found in the empty JSON string", TestFormObjectMultipartRequestMarker.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,12 +144,12 @@ public class TestFormObjectMultipartRequestMarker {
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Map.Entry<String, JsonElement> entry : entries) {
|
||||
if (!TestFormObjectMultipartRequestMarker.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TestFormObjectMultipartRequestMarker` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TestFormObjectMultipartRequestMarker` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@@ -43,7 +42,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.openapitools.client.JSON;
|
||||
|
||||
@@ -216,7 +214,7 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
|
||||
if (jsonElement == null) {
|
||||
if (!TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter is not found in the empty JSON string", TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.openapiRequiredFields.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter is not found in the empty JSON string", TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,18 +222,18 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Map.Entry<String, JsonElement> entry : entries) {
|
||||
if (!TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
if ((jsonObj.get("size") != null && !jsonObj.get("size").isJsonNull()) && !jsonObj.get("size").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `size` to be a primitive type in the JSON string but got `%s`", jsonObj.get("size").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `size` to be a primitive type in the JSON string but got `%s`", jsonObj.get("size").toString()));
|
||||
}
|
||||
if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString()));
|
||||
}
|
||||
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@@ -45,7 +44,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.openapitools.client.JSON;
|
||||
|
||||
@@ -148,7 +146,7 @@ public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
|
||||
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
|
||||
if (jsonElement == null) {
|
||||
if (!TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter is not found in the empty JSON string", TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.openapiRequiredFields.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter is not found in the empty JSON string", TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,13 +154,13 @@ public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Map.Entry<String, JsonElement> entry : entries) {
|
||||
if (!TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
// ensure the optional json data is an array if present
|
||||
if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString()));
|
||||
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user