Skip to content

Commit 6b2cc24

Browse files
SP-22886 - optional FaceDetection
1 parent cd7872b commit 6b2cc24

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

client/src/main/generated/com/regula/documentreader/webclient/model/FaceDetectionItem.java

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ public class FaceDetectionItem {
3434
public static final String SERIALIZED_NAME_FACE_DETECTION = "FaceDetection";
3535

3636
@SerializedName(SERIALIZED_NAME_FACE_DETECTION)
37-
@javax.annotation.Nonnull
37+
@javax.annotation.Nullable
3838
private FaceDetection faceDetection;
3939

4040
public FaceDetectionItem() {}
4141

42-
public FaceDetectionItem faceDetection(@javax.annotation.Nonnull FaceDetection faceDetection) {
42+
public FaceDetectionItem faceDetection(@javax.annotation.Nullable FaceDetection faceDetection) {
4343
this.faceDetection = faceDetection;
4444
return this;
4545
}
@@ -49,12 +49,12 @@ public FaceDetectionItem faceDetection(@javax.annotation.Nonnull FaceDetection f
4949
*
5050
* @return faceDetection
5151
*/
52-
@javax.annotation.Nonnull
52+
@javax.annotation.Nullable
5353
public FaceDetection getFaceDetection() {
5454
return faceDetection;
5555
}
5656

57-
public void setFaceDetection(@javax.annotation.Nonnull FaceDetection faceDetection) {
57+
public void setFaceDetection(@javax.annotation.Nullable FaceDetection faceDetection) {
5858
this.faceDetection = faceDetection;
5959
}
6060

@@ -104,7 +104,6 @@ private String toIndentedString(Object o) {
104104

105105
// a set of required properties/fields (JSON key names)
106106
openapiRequiredFields = new HashSet<String>();
107-
openapiRequiredFields.add("FaceDetection");
108107
}
109108

110109
/**
@@ -124,18 +123,11 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
124123
}
125124
}
126125

127-
// check to make sure all required properties/fields are present in the JSON string
128-
for (String requiredField : FaceDetectionItem.openapiRequiredFields) {
129-
if (jsonElement.getAsJsonObject().get(requiredField) == null) {
130-
throw new IllegalArgumentException(
131-
String.format(
132-
"The required field `%s` is not found in the JSON string: %s",
133-
requiredField, jsonElement.toString()));
134-
}
135-
}
136126
JsonObject jsonObj = jsonElement.getAsJsonObject();
137-
// validate the required field `FaceDetection`
138-
FaceDetection.validateJsonElement(jsonObj.get("FaceDetection"));
127+
// validate the optional field `FaceDetection`
128+
if (jsonObj.get("FaceDetection") != null && !jsonObj.get("FaceDetection").isJsonNull()) {
129+
FaceDetection.validateJsonElement(jsonObj.get("FaceDetection"));
130+
}
139131
}
140132

141133
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {

client/src/main/generated/com/regula/documentreader/webclient/model/FaceDetectionResult.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ public class FaceDetectionResult extends ResultItem {
3434
public static final String SERIALIZED_NAME_FACE_DETECTION = "FaceDetection";
3535

3636
@SerializedName(SERIALIZED_NAME_FACE_DETECTION)
37-
@javax.annotation.Nonnull
37+
@javax.annotation.Nullable
3838
private FaceDetection faceDetection;
3939

4040
public FaceDetectionResult() {}
4141

42-
public FaceDetectionResult faceDetection(@javax.annotation.Nonnull FaceDetection faceDetection) {
42+
public FaceDetectionResult faceDetection(@javax.annotation.Nullable FaceDetection faceDetection) {
4343
this.faceDetection = faceDetection;
4444
return this;
4545
}
@@ -49,12 +49,12 @@ public FaceDetectionResult faceDetection(@javax.annotation.Nonnull FaceDetection
4949
*
5050
* @return faceDetection
5151
*/
52-
@javax.annotation.Nonnull
52+
@javax.annotation.Nullable
5353
public FaceDetection getFaceDetection() {
5454
return faceDetection;
5555
}
5656

57-
public void setFaceDetection(@javax.annotation.Nonnull FaceDetection faceDetection) {
57+
public void setFaceDetection(@javax.annotation.Nullable FaceDetection faceDetection) {
5858
this.faceDetection = faceDetection;
5959
}
6060

@@ -110,7 +110,6 @@ private String toIndentedString(Object o) {
110110

111111
// a set of required properties/fields (JSON key names)
112112
openapiRequiredFields = new HashSet<String>();
113-
openapiRequiredFields.add("FaceDetection");
114113
openapiRequiredFields.add("result_type");
115114
}
116115

0 commit comments

Comments
 (0)