Skip to content

Commit 94d5b37

Browse files
Merge pull request #6 from Contrast-Security-OSS/feature/gson-validationerrorfields-issue
added the class to handle the json list for validation error fields
2 parents ef22d43 + 3a37b25 commit 94d5b37

File tree

2 files changed

+119
-3
lines changed

2 files changed

+119
-3
lines changed

src/main/java/com/contrast/labs/ai/mcp/contrast/sdkexstension/data/application/Application.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.contrast.labs.ai.mcp.contrast.sdkexstension.data.application;
22

33
import com.google.gson.annotations.SerializedName;
4+
5+
import javax.validation.Validation;
46
import java.util.List;
57

68
/**
@@ -63,7 +65,7 @@ public class Application {
6365
private List<Metadata> metadataEntities;
6466

6567
@SerializedName("validationErrorFields")
66-
private List<String> validationErrorFields;
68+
private List<ValidationErrorFields> validationErrorFields;
6769

6870
@SerializedName("missingRequiredFields")
6971
private List<String> missingRequiredFields;
@@ -258,11 +260,11 @@ public void setMetadataEntities(List<Metadata> metadataEntities) {
258260
this.metadataEntities = metadataEntities;
259261
}
260262

261-
public List<String> getValidationErrorFields() {
263+
public List<ValidationErrorFields> getValidationErrorFields() {
262264
return validationErrorFields;
263265
}
264266

265-
public void setValidationErrorFields(List<String> validationErrorFields) {
267+
public void setValidationErrorFields(List<ValidationErrorFields> validationErrorFields) {
266268
this.validationErrorFields = validationErrorFields;
267269
}
268270

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
package com.contrast.labs.ai.mcp.contrast.sdkexstension.data.application;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
5+
import javax.validation.Validation;
6+
import java.util.List;
7+
8+
public class ValidationErrorFields {
9+
10+
/**
11+
* Represents ValidationErrorFields information for an application.
12+
*/
13+
14+
/**
15+
* "validationErrorFields" : [ {
16+
* "fieldId" : 29,
17+
* "fieldType" : "STRING",
18+
* "displayLabel" : "Custom Name",
19+
* "agentLabel" : "customName",
20+
* "required" : false,
21+
* "unique" : false,
22+
* "subfields" : null,
23+
* "links" : [ ]
24+
* }, { ... } ]
25+
*/
26+
27+
@SerializedName("fieldId")
28+
private String fieldId;
29+
30+
@SerializedName("fieldType")
31+
private String fieldType;
32+
33+
@SerializedName("displayLabel")
34+
private String displayLabel;
35+
36+
@SerializedName("agentLabel")
37+
private String agentLabel;
38+
39+
@SerializedName("required")
40+
private boolean required;
41+
42+
@SerializedName("unique")
43+
private boolean unique;
44+
45+
@SerializedName("subfields")
46+
private List<ValidationErrorFields> subfields;
47+
48+
@SerializedName("links")
49+
private List<String> links;
50+
51+
// Getters and setters
52+
public String getFieldId() {
53+
return fieldId;
54+
}
55+
public void setFieldId(String fieldId) {
56+
this.fieldId = fieldId;
57+
}
58+
public String getFieldType() {
59+
return fieldType;
60+
}
61+
public void setFieldType(String fieldType) {
62+
this.fieldType = fieldType;
63+
}
64+
public String getDisplayLabel() {
65+
return displayLabel;
66+
}
67+
public void setDisplayLabel(String displayLabel) {
68+
this.displayLabel = displayLabel;
69+
}
70+
public String getAgentLabel() {
71+
return agentLabel;
72+
}
73+
public void setAgentLabel(String agentLabel) {
74+
this.agentLabel = agentLabel;
75+
}
76+
public boolean isRequired() {
77+
return required;
78+
}
79+
public void setRequired(boolean required) {
80+
this.required = required;
81+
}
82+
public boolean isUnique() {
83+
return unique;
84+
}
85+
public void setUnique(boolean unique) {
86+
this.unique = unique;
87+
}
88+
public List<ValidationErrorFields> getSubfields() {
89+
return subfields;
90+
}
91+
public void setSubfields(List<ValidationErrorFields> subfields) {
92+
this.subfields = subfields;
93+
}
94+
public List<String> getLinks() {
95+
return links;
96+
}
97+
public void setLinks(List<String> links) {
98+
this.links = links;
99+
}
100+
101+
@Override
102+
public String toString() {
103+
return "ValidationErrorFields{" +
104+
"fieldId='" + fieldId + '\'' +
105+
", fieldType='" + fieldType + '\'' +
106+
", displayLabel='" + displayLabel + '\'' +
107+
", agentLabel='" + agentLabel + '\'' +
108+
", required=" + required + '\'' +
109+
", unique=" + unique + '\'' +
110+
", subfields=" + subfields + '\'' +
111+
", links=" + links +
112+
'}';
113+
}
114+
}

0 commit comments

Comments
 (0)