Skip to content

Commit 7109d88

Browse files
fix(boxsdkgen)!: Mark id field of AIAgentReference required (box/box-openapi#1629) (box/box-openapi#595) (#1826)
1 parent f2a7914 commit 7109d88

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "c571efa", "specHash": "f899bf6", "version": "5.9.0" }
1+
{ "engineHash": "c571efa", "specHash": "65c9c57", "version": "5.9.0" }

src/intTest/java/com/box/sdkgen/aistudio/AiStudioITest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void testUseAiAgentReferenceInAiAsk() {
8787
new AiItemAsk.Builder(fileToAsk.getId(), AiItemAskTypeField.FILE)
8888
.content("The Sun rises in the east.")
8989
.build()))
90-
.aiAgent(new AiAgentReference.Builder().id(createdAgent.getId()).build())
90+
.aiAgent(new AiAgentReference(createdAgent.getId()))
9191
.build());
9292
assert response.getAnswer().contains("east");
9393
assert response.getCompletionReason().equals("done");

src/main/java/com/box/sdkgen/schemas/aiagentreference/AiAgentReference.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.box.sdkgen.internal.SerializableObject;
55
import com.box.sdkgen.serialization.json.EnumWrapper;
66
import com.fasterxml.jackson.annotation.JsonFilter;
7+
import com.fasterxml.jackson.annotation.JsonProperty;
78
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
89
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
910
import java.util.Objects;
@@ -23,10 +24,11 @@ public class AiAgentReference extends SerializableObject {
2324
* Extract
2425
* Agent](https://developer.box.com/guides/box-ai/ai-tutorials/extract-metadata-structured#enhanced-extract-agent)).
2526
*/
26-
protected String id;
27+
protected final String id;
2728

28-
public AiAgentReference() {
29+
public AiAgentReference(@JsonProperty("id") String id) {
2930
super();
31+
this.id = id;
3032
this.type = new EnumWrapper<AiAgentReferenceTypeField>(AiAgentReferenceTypeField.AI_AGENT_ID);
3133
}
3234

@@ -71,10 +73,11 @@ public static class Builder extends NullableFieldTracker {
7173

7274
protected EnumWrapper<AiAgentReferenceTypeField> type;
7375

74-
protected String id;
76+
protected final String id;
7577

76-
public Builder() {
78+
public Builder(String id) {
7779
super();
80+
this.id = id;
7881
}
7982

8083
public Builder type(AiAgentReferenceTypeField type) {
@@ -87,11 +90,6 @@ public Builder type(EnumWrapper<AiAgentReferenceTypeField> type) {
8790
return this;
8891
}
8992

90-
public Builder id(String id) {
91-
this.id = id;
92-
return this;
93-
}
94-
9593
public AiAgentReference build() {
9694
if (this.type == null) {
9795
this.type =

0 commit comments

Comments
 (0)