Skip to content

Commit a677384

Browse files
Merge pull request #177 from regulaforensics/fix/SP-22413
SP-22413 - disable additional fields validation, update schemas
2 parents e966b6b + cac5905 commit a677384

File tree

185 files changed

+865
-2456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+865
-2456
lines changed

.github/workflows/sast.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ env:
1717
# List of paths (space separated) to ignore
1818
# Supports PATTERNS
1919
# EXCLUDE_PATHS: 'foo bar/baz file.txt dir/*.yml'
20-
EXCLUDE_PATHS: 'client/generator-templates src/main/generated'
20+
EXCLUDE_PATHS: 'client/generator-templates client/src/main/generated'
2121
# List of rules (space separated) to ignore
2222
# EXCLUDE_RULES: 'generic.secrets.security.detected-aws-account-id.detected-aws-account-id'
2323
# See https://github.com/semgrep/semgrep-rules for rules registry

client/.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ src/main/generated/com/regula/documentreader/webclient/model/OutData.java
144144
src/main/generated/com/regula/documentreader/webclient/model/OutDataTransactionImagesFieldValue.java
145145
src/main/generated/com/regula/documentreader/webclient/model/PArrayField.java
146146
src/main/generated/com/regula/documentreader/webclient/model/ParsedData.java
147+
src/main/generated/com/regula/documentreader/webclient/model/ParsingErrorCodes.java
147148
src/main/generated/com/regula/documentreader/webclient/model/ParsingNotificationCodes.java
148149
src/main/generated/com/regula/documentreader/webclient/model/PerDocumentConfig.java
149150
src/main/generated/com/regula/documentreader/webclient/model/PhotoIdentItem.java

client/generator-templates/pojo.mustache

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,16 +337,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
337337
}
338338
}
339339
{{^hasChildren}}
340-
{{^isAdditionalPropertiesTrue}}
341340

342-
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
343-
// check to see if the JSON string contains additional fields
344-
for (Map.Entry<String, JsonElement> entry : entries) {
345-
if (!{{classname}}.openapiFields.contains(entry.getKey())) {
346-
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `{{classname}}` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
347-
}
348-
}
349-
{{/isAdditionalPropertiesTrue}}
350341
{{#requiredVars}}
351342
{{#-first}}
352343

client/src/main/generated/com/regula/documentreader/webclient/JSON.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,13 @@ public static GsonBuilder createGson() {
7878
"131072", com.regula.documentreader.webclient.model.IdentResult.class);
7979
classByDiscriminatorValue.put(
8080
"16", com.regula.documentreader.webclient.model.FiberResult.class);
81-
classByDiscriminatorValue.put(
82-
"16384", com.regula.documentreader.webclient.model.FiberResult.class);
8381
classByDiscriminatorValue.put(
8482
"16777216",
8583
com.regula.documentreader.webclient.model.OCRSecurityTextResult.class);
8684
classByDiscriminatorValue.put(
8785
"2", com.regula.documentreader.webclient.model.SecurityFeatureResult.class);
88-
classByDiscriminatorValue.put(
89-
"2048", com.regula.documentreader.webclient.model.IdentResult.class);
9086
classByDiscriminatorValue.put(
9187
"2097152", com.regula.documentreader.webclient.model.IdentResult.class);
92-
classByDiscriminatorValue.put(
93-
"2147483648",
94-
com.regula.documentreader.webclient.model.SecurityFeatureResult.class);
95-
classByDiscriminatorValue.put(
96-
"256", com.regula.documentreader.webclient.model.PhotoIdentResult.class);
9788
classByDiscriminatorValue.put(
9889
"262144", com.regula.documentreader.webclient.model.IdentResult.class);
9990
classByDiscriminatorValue.put(
@@ -158,22 +149,13 @@ public static GsonBuilder createGson() {
158149
"131072", com.regula.documentreader.webclient.model.IdentResult.class);
159150
classByDiscriminatorValue.put(
160151
"16", com.regula.documentreader.webclient.model.FiberResult.class);
161-
classByDiscriminatorValue.put(
162-
"16384", com.regula.documentreader.webclient.model.FiberResult.class);
163152
classByDiscriminatorValue.put(
164153
"16777216",
165154
com.regula.documentreader.webclient.model.OCRSecurityTextResult.class);
166155
classByDiscriminatorValue.put(
167156
"2", com.regula.documentreader.webclient.model.SecurityFeatureResult.class);
168-
classByDiscriminatorValue.put(
169-
"2048", com.regula.documentreader.webclient.model.IdentResult.class);
170157
classByDiscriminatorValue.put(
171158
"2097152", com.regula.documentreader.webclient.model.IdentResult.class);
172-
classByDiscriminatorValue.put(
173-
"2147483648",
174-
com.regula.documentreader.webclient.model.SecurityFeatureResult.class);
175-
classByDiscriminatorValue.put(
176-
"256", com.regula.documentreader.webclient.model.PhotoIdentResult.class);
177159
classByDiscriminatorValue.put(
178160
"262144", com.regula.documentreader.webclient.model.IdentResult.class);
179161
classByDiscriminatorValue.put(

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
import java.util.ArrayList;
2929
import java.util.HashSet;
3030
import java.util.List;
31-
import java.util.Map;
3231
import java.util.Objects;
33-
import java.util.Set;
3432

3533
/** AreaArray */
3634
@javax.annotation.Generated(
@@ -204,17 +202,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
204202
}
205203
}
206204

207-
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
208-
// check to see if the JSON string contains additional fields
209-
for (Map.Entry<String, JsonElement> entry : entries) {
210-
if (!AreaArray.openapiFields.contains(entry.getKey())) {
211-
throw new IllegalArgumentException(
212-
String.format(
213-
"The field `%s` in the JSON string is not defined in the `AreaArray` properties. JSON: %s",
214-
entry.getKey(), jsonElement.toString()));
215-
}
216-
}
217-
218205
// check to make sure all required properties/fields are present in the JSON string
219206
for (String requiredField : AreaArray.openapiRequiredFields) {
220207
if (jsonElement.getAsJsonObject().get(requiredField) == null) {

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@
2727
import java.util.ArrayList;
2828
import java.util.HashSet;
2929
import java.util.List;
30-
import java.util.Map;
3130
import java.util.Objects;
32-
import java.util.Set;
3331

3432
/** Checked fragment coordinates */
3533
@javax.annotation.Generated(
@@ -203,17 +201,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
203201
}
204202
}
205203

206-
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
207-
// check to see if the JSON string contains additional fields
208-
for (Map.Entry<String, JsonElement> entry : entries) {
209-
if (!AreaContainer.openapiFields.contains(entry.getKey())) {
210-
throw new IllegalArgumentException(
211-
String.format(
212-
"The field `%s` in the JSON string is not defined in the `AreaContainer` properties. JSON: %s",
213-
entry.getKey(), jsonElement.toString()));
214-
}
215-
}
216-
217204
// check to make sure all required properties/fields are present in the JSON string
218205
for (String requiredField : AreaContainer.openapiRequiredFields) {
219206
if (jsonElement.getAsJsonObject().get(requiredField) == null) {

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
import com.regula.documentreader.webclient.JSON;
2525
import java.io.IOException;
2626
import java.util.HashSet;
27-
import java.util.Map;
2827
import java.util.Objects;
29-
import java.util.Set;
3028

3129
/** AuthParams */
3230
@javax.annotation.Generated(
@@ -569,16 +567,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
569567
}
570568
}
571569

572-
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
573-
// check to see if the JSON string contains additional fields
574-
for (Map.Entry<String, JsonElement> entry : entries) {
575-
if (!AuthParams.openapiFields.contains(entry.getKey())) {
576-
throw new IllegalArgumentException(
577-
String.format(
578-
"The field `%s` in the JSON string is not defined in the `AuthParams` properties. JSON: %s",
579-
entry.getKey(), jsonElement.toString()));
580-
}
581-
}
582570
JsonObject jsonObj = jsonElement.getAsJsonObject();
583571
// validate the optional field `livenessParams`
584572
if (jsonObj.get("livenessParams") != null && !jsonObj.get("livenessParams").isJsonNull()) {

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@
2727
import java.util.ArrayList;
2828
import java.util.HashSet;
2929
import java.util.List;
30-
import java.util.Map;
3130
import java.util.Objects;
32-
import java.util.Set;
3331

3432
/** AuthenticityCheckList */
3533
@javax.annotation.Generated(
@@ -166,17 +164,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
166164
}
167165
}
168166

169-
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
170-
// check to see if the JSON string contains additional fields
171-
for (Map.Entry<String, JsonElement> entry : entries) {
172-
if (!AuthenticityCheckList.openapiFields.contains(entry.getKey())) {
173-
throw new IllegalArgumentException(
174-
String.format(
175-
"The field `%s` in the JSON string is not defined in the `AuthenticityCheckList` properties. JSON: %s",
176-
entry.getKey(), jsonElement.toString()));
177-
}
178-
}
179-
180167
// check to make sure all required properties/fields are present in the JSON string
181168
for (String requiredField : AuthenticityCheckList.openapiRequiredFields) {
182169
if (jsonElement.getAsJsonObject().get(requiredField) == null) {

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
import com.regula.documentreader.webclient.JSON;
2525
import java.io.IOException;
2626
import java.util.HashSet;
27-
import java.util.Map;
2827
import java.util.Objects;
29-
import java.util.Set;
3028

3129
/** AuthenticityCheckListItem */
3230
@javax.annotation.Generated(
@@ -131,17 +129,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
131129
}
132130
}
133131

134-
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
135-
// check to see if the JSON string contains additional fields
136-
for (Map.Entry<String, JsonElement> entry : entries) {
137-
if (!AuthenticityCheckListItem.openapiFields.contains(entry.getKey())) {
138-
throw new IllegalArgumentException(
139-
String.format(
140-
"The field `%s` in the JSON string is not defined in the `AuthenticityCheckListItem` properties. JSON: %s",
141-
entry.getKey(), jsonElement.toString()));
142-
}
143-
}
144-
145132
// check to make sure all required properties/fields are present in the JSON string
146133
for (String requiredField : AuthenticityCheckListItem.openapiRequiredFields) {
147134
if (jsonElement.getAsJsonObject().get(requiredField) == null) {

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@
2727
import java.util.ArrayList;
2828
import java.util.HashSet;
2929
import java.util.List;
30-
import java.util.Map;
3130
import java.util.Objects;
32-
import java.util.Set;
3331

3432
/** AuthenticityCheckResult */
3533
@javax.annotation.Generated(
@@ -224,17 +222,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
224222
}
225223
}
226224

227-
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
228-
// check to see if the JSON string contains additional fields
229-
for (Map.Entry<String, JsonElement> entry : entries) {
230-
if (!AuthenticityCheckResult.openapiFields.contains(entry.getKey())) {
231-
throw new IllegalArgumentException(
232-
String.format(
233-
"The field `%s` in the JSON string is not defined in the `AuthenticityCheckResult` properties. JSON: %s",
234-
entry.getKey(), jsonElement.toString()));
235-
}
236-
}
237-
238225
// check to make sure all required properties/fields are present in the JSON string
239226
for (String requiredField : AuthenticityCheckResult.openapiRequiredFields) {
240227
if (jsonElement.getAsJsonObject().get(requiredField) == null) {

0 commit comments

Comments
 (0)