diff --git a/workflow-service-sdk/api/openapi.yaml b/workflow-service-sdk/api/openapi.yaml index 92d92bfeb..4f6d9a4a3 100644 --- a/workflow-service-sdk/api/openapi.yaml +++ b/workflow-service-sdk/api/openapi.yaml @@ -877,10 +877,16 @@ components: example: workFlowName: workFlowName works: - - name: name + - works: + - null + - null + name: name type: TASK status: FAILED - - name: name + - works: + - null + - null + name: name type: TASK status: FAILED workFlowExecutionId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -954,6 +960,9 @@ components: type: object WorkStatusResponseDTO: example: + works: + - null + - null name: name type: TASK status: FAILED @@ -973,6 +982,10 @@ components: - TASK - WORKFLOW type: string + works: + items: + $ref: '#/components/schemas/WorkStatusResponseDTO' + type: array type: object updateParameter_200_response: allOf: diff --git a/workflow-service-sdk/docs/WorkStatusResponseDTO.md b/workflow-service-sdk/docs/WorkStatusResponseDTO.md index 9f334c52e..832fb4c0e 100644 --- a/workflow-service-sdk/docs/WorkStatusResponseDTO.md +++ b/workflow-service-sdk/docs/WorkStatusResponseDTO.md @@ -10,6 +10,7 @@ |**name** | **String** | | [optional] | |**status** | [**StatusEnum**](#StatusEnum) | | [optional] | |**type** | [**TypeEnum**](#TypeEnum) | | [optional] | +|**works** | [**List<WorkStatusResponseDTO>**](WorkStatusResponseDTO.md) | | [optional] | diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkStatusResponseDTO.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkStatusResponseDTO.java index 8347af5e2..3b0001ff2 100644 --- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkStatusResponseDTO.java +++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkStatusResponseDTO.java @@ -13,12 +13,15 @@ package com.redhat.parodos.sdk.model; import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Map.Entry; import java.util.Objects; import java.util.Set; import com.google.gson.Gson; +import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; @@ -159,6 +162,11 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { @SerializedName(SERIALIZED_NAME_TYPE) private TypeEnum type; + public static final String SERIALIZED_NAME_WORKS = "works"; + + @SerializedName(SERIALIZED_NAME_WORKS) + private List works = new ArrayList<>(); + public WorkStatusResponseDTO() { } @@ -222,6 +230,34 @@ public void setType(TypeEnum type) { this.type = type; } + public WorkStatusResponseDTO works(List works) { + + this.works = works; + return this; + } + + public WorkStatusResponseDTO addWorksItem(WorkStatusResponseDTO worksItem) { + if (this.works == null) { + this.works = new ArrayList<>(); + } + this.works.add(worksItem); + return this; + } + + /** + * Get works + * @return works + **/ + @javax.annotation.Nullable + + public List getWorks() { + return works; + } + + public void setWorks(List works) { + this.works = works; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -233,12 +269,13 @@ public boolean equals(Object o) { WorkStatusResponseDTO workStatusResponseDTO = (WorkStatusResponseDTO) o; return Objects.equals(this.name, workStatusResponseDTO.name) && Objects.equals(this.status, workStatusResponseDTO.status) - && Objects.equals(this.type, workStatusResponseDTO.type); + && Objects.equals(this.type, workStatusResponseDTO.type) + && Objects.equals(this.works, workStatusResponseDTO.works); } @Override public int hashCode() { - return Objects.hash(name, status, type); + return Objects.hash(name, status, type, works); } @Override @@ -248,6 +285,7 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" works: ").append(toIndentedString(works)).append("\n"); sb.append("}"); return sb.toString(); } @@ -273,6 +311,7 @@ private String toIndentedString(Object o) { openapiFields.add("name"); openapiFields.add("status"); openapiFields.add("type"); + openapiFields.add("works"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); @@ -323,6 +362,23 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } + if (jsonObj.get("works") != null && !jsonObj.get("works").isJsonNull()) { + JsonArray jsonArrayworks = jsonObj.getAsJsonArray("works"); + if (jsonArrayworks != null) { + // ensure the json data is an array + if (!jsonObj.get("works").isJsonArray()) { + throw new IllegalArgumentException( + String.format("Expected the field `works` to be an array in the JSON string but got `%s`", + jsonObj.get("works").toString())); + } + + // validate the optional field `works` (array) + for (int i = 0; i < jsonArrayworks.size(); i++) { + WorkStatusResponseDTO.validateJsonObject(jsonArrayworks.get(i).getAsJsonObject()); + } + ; + } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory {