Skip to content

Commit

Permalink
regenerate samples
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreatma committed Nov 6, 2023
1 parent cc9eb53 commit 083ddc7
Show file tree
Hide file tree
Showing 49 changed files with 502 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ public ArrayStringEnumDefaultEnum read(final JsonReader jsonReader) throws IOExc
return ArrayStringEnumDefaultEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
ArrayStringEnumDefaultEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_ARRAY_STRING_ENUM_DEFAULT = "array_string_enum_default";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException {
return StatusEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
StatusEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_STATUS = "status";
Expand Down Expand Up @@ -399,6 +404,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("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()) {
StatusEnum.validateJsonElement(jsonObj.get("status"));
}
}

public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ public OutcomesEnum read(final JsonReader jsonReader) throws IOException {
return OutcomesEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
OutcomesEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_OUTCOMES = "outcomes";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
Expand Down Expand Up @@ -70,5 +71,10 @@ public StringEnumRef read(final JsonReader jsonReader) throws IOException {
return StringEnumRef.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
StringEnumRef.fromValue(value);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException {
return TypeEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
TypeEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_$_TYPE = "$_type";
Expand Down Expand Up @@ -314,6 +319,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
if ((jsonObj.get("$_type") != null && !jsonObj.get("$_type").isJsonNull()) && !jsonObj.get("$_type").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `$_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("$_type").toString()));
}
// validate the optional field `$_type`
if (jsonObj.get("$_type") != null && !jsonObj.get("$_type").isJsonNull()) {
TypeEnum.validateJsonElement(jsonObj.get("$_type"));
}
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException {
return StatusEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
StatusEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_STATUS = "status";
Expand Down Expand Up @@ -382,6 +387,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("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()) {
StatusEnum.validateJsonElement(jsonObj.get("status"));
}
}

public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException {
return StatusEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
StatusEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_STATUS = "status";
Expand Down Expand Up @@ -442,6 +447,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("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()) {
StatusEnum.validateJsonElement(jsonObj.get("status"));
}
}

public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException {
return StatusEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
StatusEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_STATUS = "status";
Expand Down Expand Up @@ -382,6 +387,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("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()) {
StatusEnum.validateJsonElement(jsonObj.get("status"));
}
}

public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException {
return StatusEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
StatusEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_STATUS = "status";
Expand Down Expand Up @@ -442,6 +447,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("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()) {
StatusEnum.validateJsonElement(jsonObj.get("status"));
}
}

public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ public KindEnum read(final JsonReader jsonReader) throws IOException {
return KindEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
KindEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_KIND = "kind";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ public JustSymbolEnum read(final JsonReader jsonReader) throws IOException {
return JustSymbolEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
JustSymbolEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_JUST_SYMBOL = "just_symbol";
Expand Down Expand Up @@ -149,6 +154,11 @@ public ArrayEnumEnum read(final JsonReader jsonReader) throws IOException {
return ArrayEnumEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
ArrayEnumEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_ARRAY_ENUM = "array_enum";
Expand Down Expand Up @@ -286,6 +296,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
if ((jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonNull()) && !jsonObj.get("just_symbol").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `just_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("just_symbol").toString()));
}
// validate the optional field `just_symbol`
if (jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonNull()) {
JustSymbolEnum.validateJsonElement(jsonObj.get("just_symbol"));
}
// ensure the optional json data is an array if present
if (jsonObj.get("array_enum") != null && !jsonObj.get("array_enum").isJsonNull() && !jsonObj.get("array_enum").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `array_enum` to be an array in the JSON string but got `%s`", jsonObj.get("array_enum").toString()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
Expand Down Expand Up @@ -70,5 +71,10 @@ public EnumClass read(final JsonReader jsonReader) throws IOException {
return EnumClass.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
EnumClass.fromValue(value);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ public EnumStringEnum read(final JsonReader jsonReader) throws IOException {
return EnumStringEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
EnumStringEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_ENUM_STRING = "enum_string";
Expand Down Expand Up @@ -152,6 +157,11 @@ public EnumStringRequiredEnum read(final JsonReader jsonReader) throws IOExcepti
return EnumStringRequiredEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
EnumStringRequiredEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_ENUM_STRING_REQUIRED = "enum_string_required";
Expand Down Expand Up @@ -203,6 +213,11 @@ public EnumIntegerEnum read(final JsonReader jsonReader) throws IOException {
return EnumIntegerEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
Integer value = jsonElement.getAsInt();
EnumIntegerEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_ENUM_INTEGER = "enum_integer";
Expand Down Expand Up @@ -254,6 +269,11 @@ public EnumNumberEnum read(final JsonReader jsonReader) throws IOException {
return EnumNumberEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
Double value = jsonElement.getAsDouble();
EnumNumberEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_ENUM_NUMBER = "enum_number";
Expand Down Expand Up @@ -467,9 +487,27 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
if ((jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonNull()) && !jsonObj.get("enum_string").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `enum_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string").toString()));
}
// validate the optional field `enum_string`
if (jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonNull()) {
EnumStringEnum.validateJsonElement(jsonObj.get("enum_string"));
}
if (!jsonObj.get("enum_string_required").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `enum_string_required` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string_required").toString()));
}
// validate the required field `enum_string_required`
EnumStringRequiredEnum.validateJsonElement(jsonObj.get("enum_string_required"));
// validate the optional field `enum_integer`
if (jsonObj.get("enum_integer") != null && !jsonObj.get("enum_integer").isJsonNull()) {
EnumIntegerEnum.validateJsonElement(jsonObj.get("enum_integer"));
}
// validate the optional field `enum_number`
if (jsonObj.get("enum_number") != null && !jsonObj.get("enum_number").isJsonNull()) {
EnumNumberEnum.validateJsonElement(jsonObj.get("enum_number"));
}
// validate the optional field `outerEnum`
if (jsonObj.get("outerEnum") != null && !jsonObj.get("outerEnum").isJsonNull()) {
OuterEnum.validateJsonElement(jsonObj.get("outerEnum"));
}
}

public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ public InnerEnum read(final JsonReader jsonReader) throws IOException {
return InnerEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
InnerEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_MAP_OF_ENUM_STRING = "map_of_enum_string";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException {
return StatusEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
StatusEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_STATUS = "status";
Expand Down Expand Up @@ -344,6 +349,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("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()) {
StatusEnum.validateJsonElement(jsonObj.get("status"));
}
}

public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
Expand Down Expand Up @@ -70,5 +71,10 @@ public OuterEnum read(final JsonReader jsonReader) throws IOException {
return OuterEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
OuterEnum.fromValue(value);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException {
return StatusEnum.fromValue(value);
}
}

public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
StatusEnum.fromValue(value);
}
}

public static final String SERIALIZED_NAME_STATUS = "status";
Expand Down Expand Up @@ -401,6 +406,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("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()) {
StatusEnum.validateJsonElement(jsonObj.get("status"));
}
}

public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
Expand Down
Loading

0 comments on commit 083ddc7

Please sign in to comment.