Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Add generated SDK files
Browse files Browse the repository at this point in the history
Signed-off-by: Moti Asayag <masayag@redhat.com>
  • Loading branch information
masayag authored and openshift-merge-robot committed May 10, 2023
1 parent d50b579 commit 47f5d36
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 4 deletions.
17 changes: 15 additions & 2 deletions workflow-service-sdk/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -954,6 +960,9 @@ components:
type: object
WorkStatusResponseDTO:
example:
works:
- null
- null
name: name
type: TASK
status: FAILED
Expand All @@ -973,6 +982,10 @@ components:
- TASK
- WORKFLOW
type: string
works:
items:
$ref: '#/components/schemas/WorkStatusResponseDTO'
type: array
type: object
updateParameter_200_response:
allOf:
Expand Down
1 change: 1 addition & 0 deletions workflow-service-sdk/docs/WorkStatusResponseDTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
|**name** | **String** | | [optional] |
|**status** | [**StatusEnum**](#StatusEnum) | | [optional] |
|**type** | [**TypeEnum**](#TypeEnum) | | [optional] |
|**works** | [**List&lt;WorkStatusResponseDTO&gt;**](WorkStatusResponseDTO.md) | | [optional] |



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<WorkStatusResponseDTO> works = new ArrayList<>();

public WorkStatusResponseDTO() {
}

Expand Down Expand Up @@ -222,6 +230,34 @@ public void setType(TypeEnum type) {
this.type = type;
}

public WorkStatusResponseDTO works(List<WorkStatusResponseDTO> 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<WorkStatusResponseDTO> getWorks() {
return works;
}

public void setWorks(List<WorkStatusResponseDTO> works) {
this.works = works;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand All @@ -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
Expand All @@ -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();
}
Expand All @@ -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<String>();
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 47f5d36

Please sign in to comment.