[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:
Christopher Molin
2025-12-17 08:15:32 +01:00
committed by GitHub
parent e1edb9e645
commit 149fdcb61f
2627 changed files with 2442 additions and 5489 deletions

View File

@@ -18,7 +18,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;
@@ -87,7 +86,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()));
}
}
@@ -95,7 +94,7 @@ 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()));
}
}
}

View File

@@ -18,7 +18,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;
@@ -87,7 +86,7 @@ public class ModelApiResponse {
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString()));
}
}
@@ -95,7 +94,7 @@ public class ModelApiResponse {
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!ModelApiResponse.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ModelApiResponse` 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 `ModelApiResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
}

View File

@@ -18,7 +18,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;
@@ -87,7 +86,7 @@ public class Order {
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString()));
}
}
@@ -95,7 +94,7 @@ public class Order {
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!Order.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Order` 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 `Order` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
}

View File

@@ -18,7 +18,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;
@@ -87,7 +86,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()));
}
}
@@ -95,7 +94,7 @@ 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()));
}
}
}

View File

@@ -18,7 +18,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;
@@ -87,7 +86,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()));
}
}
@@ -95,7 +94,7 @@ 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()));
}
}
}

View File

@@ -18,7 +18,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;
@@ -87,7 +86,7 @@ public class User {
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString()));
}
}
@@ -95,7 +94,7 @@ public class User {
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!User.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `User` 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 `User` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
}

View File

@@ -1395,7 +1395,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()
));
}
@@ -1468,11 +1468,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()));
}
}
}

View File

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

View File

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

View File

@@ -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;
@@ -190,7 +188,7 @@ public class ModelApiResponse {
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString()));
}
}
@@ -198,15 +196,15 @@ public class ModelApiResponse {
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!ModelApiResponse.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ModelApiResponse` 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 `ModelApiResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString()));
}
if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString()));
}
}

View File

@@ -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;
@@ -323,7 +321,7 @@ public class Order {
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString()));
}
}
@@ -331,12 +329,12 @@ public class Order {
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!Order.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Order` 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 `Order` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
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()) {

View File

@@ -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;
@@ -347,7 +345,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()));
}
}
@@ -355,14 +353,14 @@ 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();
@@ -371,20 +369,20 @@ public class Pet {
Category.validateJsonElement(jsonObj.get("category"));
}
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()));
}
// ensure the required json array is present
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)
@@ -394,7 +392,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()) {

View File

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

View File

@@ -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;
@@ -320,7 +318,7 @@ public class User {
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString()));
}
}
@@ -328,27 +326,27 @@ public class User {
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!User.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `User` 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 `User` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString()));
}
if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString()));
}
if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString()));
}
if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString()));
}
if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString()));
}
if ((jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) && !jsonObj.get("phone").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString()));
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString()));
}
}