Skip to content

Commit

Permalink
[OpenAPI] Enable fallback value for nullable=false enum fields (#46)
Browse files Browse the repository at this point in the history
* initial

* Fix core

* Fix orchestration

* Adjust existing test case

* Formatting

---------

Co-authored-by: SAP Cloud SDK Bot <[email protected]>
Co-authored-by: Charles Dubois <[email protected]>
  • Loading branch information
3 people authored Sep 11, 2024
1 parent 97b8012 commit 64875a3
Show file tree
Hide file tree
Showing 37 changed files with 194 additions and 79 deletions.
1 change: 1 addition & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
<pojoBuilderMethodName>create</pojoBuilderMethodName>
<pojoBuildMethodName/>
<pojoConstructorVisibility>protected</pojoConstructorVisibility>
<enumUnknownDefaultCase>true</enumUnknownDefaultCase>
</additionalProperties>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ public enum KindEnum {
RESULTSET("resultset"),

/** The OTHER option of this AiArtifact */
OTHER("other");
OTHER("other"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this AiArtifact */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down Expand Up @@ -102,7 +105,7 @@ public static KindEnum fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ public enum KindEnum {
RESULTSET("resultset"),

/** The OTHER option of this AiArtifactPostData */
OTHER("other");
OTHER("other"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this AiArtifactPostData */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down Expand Up @@ -101,7 +104,7 @@ public static KindEnum fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ public enum TargetStatusEnum {
STOPPED("STOPPED"),

/** The DELETED option of this AiDeployment */
DELETED("DELETED");
DELETED("DELETED"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this AiDeployment */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down Expand Up @@ -106,7 +109,7 @@ public static TargetStatusEnum fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}

Expand All @@ -125,7 +128,10 @@ public enum LastOperationEnum {
DELETE("DELETE"),

/** The CASCADE_UPDATE option of this AiDeployment */
CASCADE_UPDATE("CASCADE-UPDATE");
CASCADE_UPDATE("CASCADE-UPDATE"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this AiDeployment */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ public enum TargetStatusEnum {
STOPPED("STOPPED"),

/** The DELETED option of this AiDeploymentModificationRequestWithIdentifier */
DELETED("DELETED");
DELETED("DELETED"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this AiDeploymentModificationRequestWithIdentifier */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down Expand Up @@ -87,7 +90,7 @@ public static TargetStatusEnum fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ public enum TargetStatusEnum {
STOPPED("STOPPED"),

/** The DELETED option of this AiDeploymentResponseWithDetails */
DELETED("DELETED");
DELETED("DELETED"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this AiDeploymentResponseWithDetails */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down Expand Up @@ -106,7 +109,7 @@ public static TargetStatusEnum fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}

Expand All @@ -125,7 +128,10 @@ public enum LastOperationEnum {
DELETE("DELETE"),

/** The CASCADE_UPDATE option of this AiDeploymentResponseWithDetails */
CASCADE_UPDATE("CASCADE-UPDATE");
CASCADE_UPDATE("CASCADE-UPDATE"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this AiDeploymentResponseWithDetails */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public enum AiDeploymentStatus {

STOPPED("STOPPED"),

UNKNOWN("UNKNOWN");
UNKNOWN("UNKNOWN"),

UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private final String value;

Expand Down Expand Up @@ -68,6 +70,6 @@ public static AiDeploymentStatus fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

/** Status */
public enum AiDeploymentTargetStatus {
STOPPED("STOPPED");
STOPPED("STOPPED"),

UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private final String value;

Expand Down Expand Up @@ -56,6 +58,6 @@ public static AiDeploymentTargetStatus fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ public class AiExecutableParameter
/** Type of the executable parameter */
public enum TypeEnum {
/** The STRING option of this AiExecutableParameter */
STRING("string");
STRING("string"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this AiExecutableParameter */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down Expand Up @@ -87,7 +90,7 @@ public static TypeEnum fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ public enum TargetStatusEnum {
STOPPED("STOPPED"),

/** The DELETED option of this AiExecution */
DELETED("DELETED");
DELETED("DELETED"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this AiExecution */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down Expand Up @@ -102,7 +105,7 @@ public static TargetStatusEnum fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ public class AiExecutionModificationRequest
/** Desired target status of the execution (currently only STOPPED is supported) */
public enum TargetStatusEnum {
/** The STOPPED option of this AiExecutionModificationRequest */
STOPPED("STOPPED");
STOPPED("STOPPED"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this AiExecutionModificationRequest */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down Expand Up @@ -81,7 +84,7 @@ public static TargetStatusEnum fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ public enum TargetStatusEnum {
STOPPED("STOPPED"),

/** The DELETED option of this AiExecutionModificationRequestWithIdentifier */
DELETED("DELETED");
DELETED("DELETED"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this AiExecutionModificationRequestWithIdentifier */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down Expand Up @@ -87,7 +90,7 @@ public static TargetStatusEnum fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ public enum TargetStatusEnum {
STOPPED("STOPPED"),

/** The DELETED option of this AiExecutionResponseWithDetails */
DELETED("DELETED");
DELETED("DELETED"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this AiExecutionResponseWithDetails */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down Expand Up @@ -102,7 +105,7 @@ public static TargetStatusEnum fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
public enum AiExecutionScheduleStatus {
ACTIVE("ACTIVE"),

INACTIVE("INACTIVE");
INACTIVE("INACTIVE"),

UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private final String value;

Expand Down Expand Up @@ -58,6 +60,6 @@ public static AiExecutionScheduleStatus fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public enum AiExecutionStatus {

STOPPED("STOPPED"),

UNKNOWN("UNKNOWN");
UNKNOWN("UNKNOWN"),

UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private final String value;

Expand Down Expand Up @@ -68,6 +70,6 @@ public static AiExecutionStatus fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ public enum StatusEnum {
IN_PROGRESS("IN-PROGRESS"),

/** The COMPLETED option of this BckndArgoCDRepositoryDetails */
COMPLETED("COMPLETED");
COMPLETED("COMPLETED"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this BckndArgoCDRepositoryDetails */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down Expand Up @@ -90,7 +93,7 @@ public static StatusEnum fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ public enum ActionEnum {
PROVISION("PROVISION"),

/** The DEPROVISION option of this BckndEvent */
DEPROVISION("DEPROVISION");
DEPROVISION("DEPROVISION"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this BckndEvent */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down Expand Up @@ -85,7 +88,7 @@ public static ActionEnum fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}

Expand All @@ -101,7 +104,10 @@ public enum StateEnum {
FAILED("FAILED"),

/** The PENDING option of this BckndEvent */
PENDING("PENDING");
PENDING("PENDING"),

/** The UNKNOWN_DEFAULT_OPEN_API option of this BckndEvent */
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;

Expand Down Expand Up @@ -145,7 +151,7 @@ public static StateEnum fromValue(@Nonnull final String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
return UNKNOWN_DEFAULT_OPEN_API;
}
}

Expand Down
Loading

0 comments on commit 64875a3

Please sign in to comment.