diff --git a/docs/BotInfo.md b/docs/BotInfo.md index 3464090e..86e33c55 100644 --- a/docs/BotInfo.md +++ b/docs/BotInfo.md @@ -25,6 +25,7 @@ Extended bot information. | SIGNED | "signed" | | SPOOFED | "spoofed" | | UNKNOWN | "unknown" | +| UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED | "unsupported_value_sdk_upgrade_required" | @@ -35,6 +36,7 @@ Extended bot information. | LOW | "low" | | MEDIUM | "medium" | | HIGH | "high" | +| UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED | "unsupported_value_sdk_upgrade_required" | diff --git a/docs/BotResult.md b/docs/BotResult.md index cdbc0a41..736a0de5 100644 --- a/docs/BotResult.md +++ b/docs/BotResult.md @@ -16,5 +16,7 @@ Bot detection result: * `NOT_DETECTED` (value: `"not_detected"`) +* `UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED` (value: `"unsupported_value_sdk_upgrade_required"`) + diff --git a/docs/ErrorCode.md b/docs/ErrorCode.md index 6d22a8ce..bcad66b0 100644 --- a/docs/ErrorCode.md +++ b/docs/ErrorCode.md @@ -66,5 +66,7 @@ Error code: * `RULESET_NOT_FOUND` (value: `"ruleset_not_found"`) +* `UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED` (value: `"unsupported_value_sdk_upgrade_required"`) + diff --git a/docs/Proximity.md b/docs/Proximity.md index b9a3126f..972576a9 100644 --- a/docs/Proximity.md +++ b/docs/Proximity.md @@ -27,6 +27,7 @@ Proximity ID represents a fixed geographical zone in a discrete global grid with | NUMBER_3300 | 3300 | | NUMBER_8500 | 8500 | | NUMBER_22500 | 22500 | +| UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED | Integer.MAX_VALUE | diff --git a/docs/ProxyConfidence.md b/docs/ProxyConfidence.md index f3329de5..d5ad4e49 100644 --- a/docs/ProxyConfidence.md +++ b/docs/ProxyConfidence.md @@ -13,5 +13,7 @@ Confidence level of the proxy detection. If a proxy is not detected, confidence * `HIGH` (value: `"high"`) +* `UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED` (value: `"unsupported_value_sdk_upgrade_required"`) + diff --git a/docs/ProxyDetails.md b/docs/ProxyDetails.md index 8e1876f3..85a60f19 100644 --- a/docs/ProxyDetails.md +++ b/docs/ProxyDetails.md @@ -20,6 +20,7 @@ Proxy detection details (present if `proxy` is `true`) |---- | -----| | RESIDENTIAL | "residential" | | DATA_CENTER | "data_center" | +| UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED | "unsupported_value_sdk_upgrade_required" | diff --git a/docs/RuleActionType.md b/docs/RuleActionType.md index 4257e1ae..99978996 100644 --- a/docs/RuleActionType.md +++ b/docs/RuleActionType.md @@ -10,5 +10,7 @@ Describes the action to take with the request. * `BLOCK` (value: `"block"`) +* `UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED` (value: `"unsupported_value_sdk_upgrade_required"`) + diff --git a/docs/SDK.md b/docs/SDK.md index 3a42f60b..3a902aef 100644 --- a/docs/SDK.md +++ b/docs/SDK.md @@ -22,6 +22,7 @@ Contains information about the SDK used to perform the request. | ANDROID | "android" | | IOS | "ios" | | UNKNOWN | "unknown" | +| UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED | "unsupported_value_sdk_upgrade_required" | diff --git a/docs/SearchEventsBot.md b/docs/SearchEventsBot.md index 74c0ce63..ee96b431 100644 --- a/docs/SearchEventsBot.md +++ b/docs/SearchEventsBot.md @@ -20,5 +20,7 @@ Filter events by the Bot Detection result, specifically: * `NONE` (value: `"none"`) +* `UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED` (value: `"unsupported_value_sdk_upgrade_required"`) + diff --git a/docs/SearchEventsSdkPlatform.md b/docs/SearchEventsSdkPlatform.md index f183a343..20316e1a 100644 --- a/docs/SearchEventsSdkPlatform.md +++ b/docs/SearchEventsSdkPlatform.md @@ -16,5 +16,7 @@ Filter events by the SDK Platform associated with the identification event (`sdk * `IOS` (value: `"ios"`) +* `UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED` (value: `"unsupported_value_sdk_upgrade_required"`) + diff --git a/docs/SearchEventsVpnConfidence.md b/docs/SearchEventsVpnConfidence.md index 3ad6e805..8fd1b8c7 100644 --- a/docs/SearchEventsVpnConfidence.md +++ b/docs/SearchEventsVpnConfidence.md @@ -17,5 +17,7 @@ Filter events by VPN Detection result confidence level. * `LOW` (value: `"low"`) +* `UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED` (value: `"unsupported_value_sdk_upgrade_required"`) + diff --git a/docs/VpnConfidence.md b/docs/VpnConfidence.md index f0d0d9ef..1495ee5e 100644 --- a/docs/VpnConfidence.md +++ b/docs/VpnConfidence.md @@ -12,5 +12,7 @@ A confidence rating for the VPN detection result — "low", "medium", or "high". * `HIGH` (value: `"high"`) +* `UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED` (value: `"unsupported_value_sdk_upgrade_required"`) + diff --git a/sdk/sdk.gradle.kts b/sdk/sdk.gradle.kts index 5eef752a..77a58d65 100644 --- a/sdk/sdk.gradle.kts +++ b/sdk/sdk.gradle.kts @@ -80,6 +80,7 @@ openApiGenerate { configOptions.put("openApiNullable", "false") configOptions.put("disallowAdditionalPropertiesIfNotPresent", "false") configOptions.put("useOneOfInterfaces", "true") + configOptions.put("enumUnknownDefaultCase", "true") } tasks.register("removeDocs") { diff --git a/sdk/src/main/java/com/fingerprint/v4/model/BotInfo.java b/sdk/src/main/java/com/fingerprint/v4/model/BotInfo.java index 10ed401c..9e6e359f 100644 --- a/sdk/src/main/java/com/fingerprint/v4/model/BotInfo.java +++ b/sdk/src/main/java/com/fingerprint/v4/model/BotInfo.java @@ -56,7 +56,9 @@ public enum IdentityEnum { SPOOFED(String.valueOf("spoofed")), - UNKNOWN(String.valueOf("unknown")); + UNKNOWN(String.valueOf("unknown")), + + UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED("unsupported_value_sdk_upgrade_required"); private String value; @@ -81,7 +83,7 @@ public static IdentityEnum fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED; } } @@ -96,7 +98,9 @@ public enum ConfidenceEnum { MEDIUM(String.valueOf("medium")), - HIGH(String.valueOf("high")); + HIGH(String.valueOf("high")), + + UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED("unsupported_value_sdk_upgrade_required"); private String value; @@ -121,7 +125,7 @@ public static ConfidenceEnum fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED; } } diff --git a/sdk/src/main/java/com/fingerprint/v4/model/BotResult.java b/sdk/src/main/java/com/fingerprint/v4/model/BotResult.java index 1d6a4697..6fc37756 100644 --- a/sdk/src/main/java/com/fingerprint/v4/model/BotResult.java +++ b/sdk/src/main/java/com/fingerprint/v4/model/BotResult.java @@ -23,7 +23,9 @@ public enum BotResult { GOOD("good"), - NOT_DETECTED("not_detected"); + NOT_DETECTED("not_detected"), + + UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED("unsupported_value_sdk_upgrade_required"); private String value; @@ -48,6 +50,6 @@ public static BotResult fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED; } } diff --git a/sdk/src/main/java/com/fingerprint/v4/model/ErrorCode.java b/sdk/src/main/java/com/fingerprint/v4/model/ErrorCode.java index 5f2888de..384100db 100644 --- a/sdk/src/main/java/com/fingerprint/v4/model/ErrorCode.java +++ b/sdk/src/main/java/com/fingerprint/v4/model/ErrorCode.java @@ -53,7 +53,9 @@ public enum ErrorCode { SERVICE_UNAVAILABLE("service_unavailable"), - RULESET_NOT_FOUND("ruleset_not_found"); + RULESET_NOT_FOUND("ruleset_not_found"), + + UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED("unsupported_value_sdk_upgrade_required"); private String value; @@ -78,6 +80,6 @@ public static ErrorCode fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED; } } diff --git a/sdk/src/main/java/com/fingerprint/v4/model/Proximity.java b/sdk/src/main/java/com/fingerprint/v4/model/Proximity.java index 5ac8b254..95e7b643 100644 --- a/sdk/src/main/java/com/fingerprint/v4/model/Proximity.java +++ b/sdk/src/main/java/com/fingerprint/v4/model/Proximity.java @@ -54,7 +54,9 @@ public enum PrecisionRadiusEnum { NUMBER_8500(Integer.valueOf(8500)), - NUMBER_22500(Integer.valueOf(22500)); + NUMBER_22500(Integer.valueOf(22500)), + + UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED(Integer.MAX_VALUE); private Integer value; @@ -79,7 +81,7 @@ public static PrecisionRadiusEnum fromValue(Integer value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED; } } diff --git a/sdk/src/main/java/com/fingerprint/v4/model/ProxyConfidence.java b/sdk/src/main/java/com/fingerprint/v4/model/ProxyConfidence.java index 00c8cd1e..4e076d75 100644 --- a/sdk/src/main/java/com/fingerprint/v4/model/ProxyConfidence.java +++ b/sdk/src/main/java/com/fingerprint/v4/model/ProxyConfidence.java @@ -23,7 +23,9 @@ public enum ProxyConfidence { MEDIUM("medium"), - HIGH("high"); + HIGH("high"), + + UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED("unsupported_value_sdk_upgrade_required"); private String value; @@ -48,6 +50,6 @@ public static ProxyConfidence fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED; } } diff --git a/sdk/src/main/java/com/fingerprint/v4/model/ProxyDetails.java b/sdk/src/main/java/com/fingerprint/v4/model/ProxyDetails.java index 96687e6b..d4d7e484 100644 --- a/sdk/src/main/java/com/fingerprint/v4/model/ProxyDetails.java +++ b/sdk/src/main/java/com/fingerprint/v4/model/ProxyDetails.java @@ -37,7 +37,9 @@ public class ProxyDetails { public enum ProxyTypeEnum { RESIDENTIAL(String.valueOf("residential")), - DATA_CENTER(String.valueOf("data_center")); + DATA_CENTER(String.valueOf("data_center")), + + UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED("unsupported_value_sdk_upgrade_required"); private String value; @@ -62,7 +64,7 @@ public static ProxyTypeEnum fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED; } } diff --git a/sdk/src/main/java/com/fingerprint/v4/model/RuleActionType.java b/sdk/src/main/java/com/fingerprint/v4/model/RuleActionType.java index 335da2d7..c89f8720 100644 --- a/sdk/src/main/java/com/fingerprint/v4/model/RuleActionType.java +++ b/sdk/src/main/java/com/fingerprint/v4/model/RuleActionType.java @@ -21,7 +21,9 @@ public enum RuleActionType { ALLOW("allow"), - BLOCK("block"); + BLOCK("block"), + + UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED("unsupported_value_sdk_upgrade_required"); private String value; @@ -46,6 +48,6 @@ public static RuleActionType fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED; } } diff --git a/sdk/src/main/java/com/fingerprint/v4/model/SDK.java b/sdk/src/main/java/com/fingerprint/v4/model/SDK.java index f3265b5a..52f51f84 100644 --- a/sdk/src/main/java/com/fingerprint/v4/model/SDK.java +++ b/sdk/src/main/java/com/fingerprint/v4/model/SDK.java @@ -43,7 +43,9 @@ public enum PlatformEnum { IOS(String.valueOf("ios")), - UNKNOWN(String.valueOf("unknown")); + UNKNOWN(String.valueOf("unknown")), + + UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED("unsupported_value_sdk_upgrade_required"); private String value; @@ -68,7 +70,7 @@ public static PlatformEnum fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED; } } diff --git a/sdk/src/main/java/com/fingerprint/v4/model/SearchEventsBot.java b/sdk/src/main/java/com/fingerprint/v4/model/SearchEventsBot.java index 3d76d6f8..6663be5f 100644 --- a/sdk/src/main/java/com/fingerprint/v4/model/SearchEventsBot.java +++ b/sdk/src/main/java/com/fingerprint/v4/model/SearchEventsBot.java @@ -25,7 +25,9 @@ public enum SearchEventsBot { BAD("bad"), - NONE("none"); + NONE("none"), + + UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED("unsupported_value_sdk_upgrade_required"); private String value; @@ -50,6 +52,6 @@ public static SearchEventsBot fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED; } } diff --git a/sdk/src/main/java/com/fingerprint/v4/model/SearchEventsSdkPlatform.java b/sdk/src/main/java/com/fingerprint/v4/model/SearchEventsSdkPlatform.java index ec655caa..1e8fa911 100644 --- a/sdk/src/main/java/com/fingerprint/v4/model/SearchEventsSdkPlatform.java +++ b/sdk/src/main/java/com/fingerprint/v4/model/SearchEventsSdkPlatform.java @@ -23,7 +23,9 @@ public enum SearchEventsSdkPlatform { ANDROID("android"), - IOS("ios"); + IOS("ios"), + + UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED("unsupported_value_sdk_upgrade_required"); private String value; @@ -48,6 +50,6 @@ public static SearchEventsSdkPlatform fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED; } } diff --git a/sdk/src/main/java/com/fingerprint/v4/model/SearchEventsVpnConfidence.java b/sdk/src/main/java/com/fingerprint/v4/model/SearchEventsVpnConfidence.java index 61d27e62..556e2d51 100644 --- a/sdk/src/main/java/com/fingerprint/v4/model/SearchEventsVpnConfidence.java +++ b/sdk/src/main/java/com/fingerprint/v4/model/SearchEventsVpnConfidence.java @@ -23,7 +23,9 @@ public enum SearchEventsVpnConfidence { MEDIUM("medium"), - LOW("low"); + LOW("low"), + + UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED("unsupported_value_sdk_upgrade_required"); private String value; @@ -48,6 +50,6 @@ public static SearchEventsVpnConfidence fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED; } } diff --git a/sdk/src/main/java/com/fingerprint/v4/model/VpnConfidence.java b/sdk/src/main/java/com/fingerprint/v4/model/VpnConfidence.java index e68cc3b5..f76aec4c 100644 --- a/sdk/src/main/java/com/fingerprint/v4/model/VpnConfidence.java +++ b/sdk/src/main/java/com/fingerprint/v4/model/VpnConfidence.java @@ -23,7 +23,9 @@ public enum VpnConfidence { MEDIUM("medium"), - HIGH("high"); + HIGH("high"), + + UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED("unsupported_value_sdk_upgrade_required"); private String value; @@ -48,6 +50,6 @@ public static VpnConfidence fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED; } } diff --git a/sdk/src/test/java/com/fingerprint/v4/SerializationTest.java b/sdk/src/test/java/com/fingerprint/v4/SerializationTest.java index 1218e615..447363ad 100644 --- a/sdk/src/test/java/com/fingerprint/v4/SerializationTest.java +++ b/sdk/src/test/java/com/fingerprint/v4/SerializationTest.java @@ -1,9 +1,14 @@ package com.fingerprint.v4; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; + import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fingerprint.v4.model.Event; +import com.fingerprint.v4.model.EventRuleAction; import com.fingerprint.v4.sdk.JSON; import java.io.IOException; import java.io.InputStream; @@ -40,4 +45,55 @@ public void deserializeSerializeEvent() throws IOException { ObjectMapper springLikeObjectMapper = getMapper(); springLikeObjectMapper.writeValueAsString(event); } + + @Test + public void deserializeEventWithUnknownBotResultValue() throws IOException { + ObjectMapper sdkObjectMapper = JSON.getDefault().getMapper(); + + ObjectNode eventNode = + sdkObjectMapper.readValue( + getFileAsIOStream("mocks/events/get_event_200.json"), ObjectNode.class); + + // Set bot to an unknown enum value + eventNode.put("bot", "unknown_future_value"); + + assertDoesNotThrow( + () -> { + // Convert the modified ObjectNode back to an Event object to test deserialization + sdkObjectMapper.treeToValue(eventNode, Event.class); + }); + } + + @Test + public void deserializeEventWithUnknownSdkPlatformValue() throws IOException { + ObjectMapper sdkObjectMapper = JSON.getDefault().getMapper(); + + ObjectNode eventNode = + sdkObjectMapper.readValue( + getFileAsIOStream("mocks/events/get_event_200.json"), ObjectNode.class); + + eventNode.withObject("/sdk").put("platform", "unknown_future_value"); + + assertDoesNotThrow( + () -> { + // Convert the modified ObjectNode back to an Event object to test deserialization + sdkObjectMapper.treeToValue(eventNode, Event.class); + }); + } + + @Test + public void deserializeEventWithUnknownRuleActionTypeValue() throws IOException { + ObjectMapper sdkObjectMapper = JSON.getDefault().getMapper(); + + ObjectNode eventNode = + sdkObjectMapper.readValue( + getFileAsIOStream("mocks/events/get_event_ruleset_200.json"), ObjectNode.class); + + eventNode.withObject("/rule_action").put("type", "unknown_future_value"); + + // Convert the modified ObjectNode back to an Event object to test deserialization + Event event = sdkObjectMapper.treeToValue(eventNode, Event.class); + + assertInstanceOf(EventRuleAction.UnknownEventRuleAction.class, event.getRuleAction()); + } } diff --git a/template/enum_outer_doc.mustache b/template/enum_outer_doc.mustache index 11dbee32..46fdca76 100644 --- a/template/enum_outer_doc.mustache +++ b/template/enum_outer_doc.mustache @@ -6,5 +6,5 @@ ## Enum {{#allowableValues}}{{#enumVars}} -* `{{name}}` (value: `{{{value}}}`) +{{^-last}}* `{{name}}` (value: `{{{value}}}`){{/-last}}{{#-last}}* `UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED` (value: `{{#isString}}"unsupported_value_sdk_upgrade_required"{{/isString}}{{#isInteger}}Integer.MAX_VALUE{{/isInteger}}`){{/-last}} {{/enumVars}}{{/allowableValues}} diff --git a/template/modelEnum.mustache b/template/modelEnum.mustache index 8c1adb89..7c47f2cb 100644 --- a/template/modelEnum.mustache +++ b/template/modelEnum.mustache @@ -34,8 +34,8 @@ import java.util.Locale; {{#withXml}} @XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) {{/withXml}} - {{{name}}}({{{value}}}){{^-last}}, - {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + {{^-last}}{{{name}}}({{{value}}}),{{/-last}} + {{#-last}}UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED({{#isString}}"unsupported_value_sdk_upgrade_required"{{/isString}}{{#isInteger}}Integer.MAX_VALUE{{/isInteger}});{{/-last}}{{/enumVars}}{{/allowableValues}} private {{{dataType}}} value; @@ -64,7 +64,7 @@ import java.util.Locale; return b; } } - {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}} + {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED;{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}} } {{#gson}} diff --git a/template/modelInnerEnum.mustache b/template/modelInnerEnum.mustache index 17825230..7e7cc97a 100644 --- a/template/modelInnerEnum.mustache +++ b/template/modelInnerEnum.mustache @@ -23,8 +23,8 @@ {{#withXml}} @XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) {{/withXml}} - {{{name}}}({{^isUri}}{{dataType}}.valueOf({{/isUri}}{{{value}}}{{^isUri}}){{/isUri}}){{^-last}}, - {{/-last}}{{#-last}};{{/-last}} + {{^-last}}{{{name}}}({{^isUri}}{{dataType}}.valueOf({{/isUri}}{{{value}}}{{^isUri}}){{/isUri}}),{{/-last}} + {{#-last}}UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED({{#isString}}"unsupported_value_sdk_upgrade_required"{{/isString}}{{#isInteger}}Integer.MAX_VALUE{{/isInteger}});{{/-last}} {{/enumVars}} {{/allowableValues}} @@ -55,7 +55,7 @@ return b; } } - {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}} + {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}return UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED;{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}} } {{#gson}} diff --git a/template/pojo_doc.mustache b/template/pojo_doc.mustache index ffb3528f..1598e6fb 100644 --- a/template/pojo_doc.mustache +++ b/template/pojo_doc.mustache @@ -17,7 +17,7 @@ | Name | Value | |---- | -----|{{#allowableValues}}{{#enumVars}} -| {{name}} | {{{value}}} |{{/enumVars}}{{/allowableValues}} +{{^-last}}| {{name}} | {{{value}}} |{{/-last}}{{#-last}}| UNSUPPORTED_VALUE_SDK_UPGRADE_REQUIRED | {{#isString}}"unsupported_value_sdk_upgrade_required"{{/isString}}{{#isInteger}}Integer.MAX_VALUE{{/isInteger}} |{{/-last}}{{/enumVars}}{{/allowableValues}} {{/isEnum}}{{/vars}} {{#vendorExtensions.x-implements.0}}