From 7d506aab1450929370ad41dda2222b7b66a68015 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Tue, 5 May 2026 06:11:15 -0700 Subject: [PATCH 1/2] fix: Mark id field of AIAgentReference required (box/box-openapi#1629) (box/box-openapi#595) --- .codegen.json | 2 +- .../com/box/sdkgen/aistudio/AiStudioITest.java | 2 +- .../aiagentreference/AiAgentReference.java | 16 +++++++--------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.codegen.json b/.codegen.json index b8fed1572..e51283639 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "c571efa", "specHash": "f899bf6", "version": "5.9.0" } +{ "engineHash": "c571efa", "specHash": "65c9c57", "version": "5.9.0" } diff --git a/src/intTest/java/com/box/sdkgen/aistudio/AiStudioITest.java b/src/intTest/java/com/box/sdkgen/aistudio/AiStudioITest.java index d7d7a1784..dc266f4bb 100644 --- a/src/intTest/java/com/box/sdkgen/aistudio/AiStudioITest.java +++ b/src/intTest/java/com/box/sdkgen/aistudio/AiStudioITest.java @@ -87,7 +87,7 @@ public void testUseAiAgentReferenceInAiAsk() { new AiItemAsk.Builder(fileToAsk.getId(), AiItemAskTypeField.FILE) .content("The Sun rises in the east.") .build())) - .aiAgent(new AiAgentReference.Builder().id(createdAgent.getId()).build()) + .aiAgent(new AiAgentReference(createdAgent.getId())) .build()); assert response.getAnswer().contains("east"); assert response.getCompletionReason().equals("done"); diff --git a/src/main/java/com/box/sdkgen/schemas/aiagentreference/AiAgentReference.java b/src/main/java/com/box/sdkgen/schemas/aiagentreference/AiAgentReference.java index 8345e2480..c982876be 100644 --- a/src/main/java/com/box/sdkgen/schemas/aiagentreference/AiAgentReference.java +++ b/src/main/java/com/box/sdkgen/schemas/aiagentreference/AiAgentReference.java @@ -4,6 +4,7 @@ import com.box.sdkgen.internal.SerializableObject; import com.box.sdkgen.serialization.json.EnumWrapper; import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import java.util.Objects; @@ -23,10 +24,11 @@ public class AiAgentReference extends SerializableObject { * Extract * Agent](https://developer.box.com/guides/box-ai/ai-tutorials/extract-metadata-structured#enhanced-extract-agent)). */ - protected String id; + protected final String id; - public AiAgentReference() { + public AiAgentReference(@JsonProperty("id") String id) { super(); + this.id = id; this.type = new EnumWrapper(AiAgentReferenceTypeField.AI_AGENT_ID); } @@ -71,10 +73,11 @@ public static class Builder extends NullableFieldTracker { protected EnumWrapper type; - protected String id; + protected final String id; - public Builder() { + public Builder(String id) { super(); + this.id = id; } public Builder type(AiAgentReferenceTypeField type) { @@ -87,11 +90,6 @@ public Builder type(EnumWrapper type) { return this; } - public Builder id(String id) { - this.id = id; - return this; - } - public AiAgentReference build() { if (this.type == null) { this.type = From 06734d3bbf3cce3695bcc6de570650933668ae49 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Tue, 5 May 2026 06:41:21 -0700 Subject: [PATCH 2/2] fix: Fix metadata template schema (box/box-openapi#596) --- .codegen.json | 2 +- ...etadataTemplateRequestBodyFieldsField.java | 38 +++++- .../MetadataTemplateFieldsField.java | 112 +++++++++++++++++- ...tadataTemplateFieldsOptionsRulesField.java | 88 ++++++++++++++ .../MetadataTemplateFieldsTypeField.java | 4 +- 5 files changed, 235 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsOptionsRulesField.java diff --git a/.codegen.json b/.codegen.json index e51283639..11e9fe8c5 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "c571efa", "specHash": "65c9c57", "version": "5.9.0" } +{ "engineHash": "c571efa", "specHash": "fa39a3f", "version": "5.9.0" } diff --git a/src/main/java/com/box/sdkgen/managers/metadatatemplates/CreateMetadataTemplateRequestBodyFieldsField.java b/src/main/java/com/box/sdkgen/managers/metadatatemplates/CreateMetadataTemplateRequestBodyFieldsField.java index b72968c5e..ba4b8c43a 100644 --- a/src/main/java/com/box/sdkgen/managers/metadatatemplates/CreateMetadataTemplateRequestBodyFieldsField.java +++ b/src/main/java/com/box/sdkgen/managers/metadatatemplates/CreateMetadataTemplateRequestBodyFieldsField.java @@ -17,8 +17,8 @@ public class CreateMetadataTemplateRequestBodyFieldsField extends SerializableOb * The type of field. The basic fields are a `string` field for text, a `float` field for numbers, * and a `date` field to present the user with a date-time picker. * - *

Additionally, metadata templates support an `enum` field for a basic list of items, and ` - * multiSelect` field for a similar list of items where the user can select more than one value. + *

Additionally, metadata templates support an `enum` field for a basic list of items, and + * `multiSelect` field for a similar list of items where the user can select more than one value. * *

Metadata taxonomies are also supported as a `taxonomy` field type with a specific set of * additional properties, which describe its structure. @@ -63,6 +63,12 @@ public class CreateMetadataTemplateRequestBodyFieldsField extends SerializableOb */ protected String taxonomyKey; + /** + * The unique ID of the metadata taxonomy to use for this taxonomy field. This property is + * required when the field `type` is set to `taxonomy`. + */ + protected String taxonomyId; + /** * The namespace of the metadata taxonomy to use for this taxonomy field. This property is * required when the field `type` is set to `taxonomy`. @@ -102,6 +108,7 @@ protected CreateMetadataTemplateRequestBodyFieldsField(Builder builder) { this.hidden = builder.hidden; this.options = builder.options; this.taxonomyKey = builder.taxonomyKey; + this.taxonomyId = builder.taxonomyId; this.namespace = builder.namespace; this.optionsRules = builder.optionsRules; markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); @@ -135,6 +142,10 @@ public String getTaxonomyKey() { return taxonomyKey; } + public String getTaxonomyId() { + return taxonomyId; + } + public String getNamespace() { return namespace; } @@ -160,6 +171,7 @@ public boolean equals(Object o) { && Objects.equals(hidden, casted.hidden) && Objects.equals(options, casted.options) && Objects.equals(taxonomyKey, casted.taxonomyKey) + && Objects.equals(taxonomyId, casted.taxonomyId) && Objects.equals(namespace, casted.namespace) && Objects.equals(optionsRules, casted.optionsRules); } @@ -167,7 +179,16 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - type, key, displayName, description, hidden, options, taxonomyKey, namespace, optionsRules); + type, + key, + displayName, + description, + hidden, + options, + taxonomyKey, + taxonomyId, + namespace, + optionsRules); } @Override @@ -201,6 +222,10 @@ public String toString() { + taxonomyKey + '\'' + ", " + + "taxonomyId='" + + taxonomyId + + '\'' + + ", " + "namespace='" + namespace + '\'' @@ -227,6 +252,8 @@ public static class Builder extends NullableFieldTracker { protected String taxonomyKey; + protected String taxonomyId; + protected String namespace; protected CreateMetadataTemplateRequestBodyFieldsOptionsRulesField optionsRules; @@ -269,6 +296,11 @@ public Builder taxonomyKey(String taxonomyKey) { return this; } + public Builder taxonomyId(String taxonomyId) { + this.taxonomyId = taxonomyId; + return this; + } + public Builder namespace(String namespace) { this.namespace = namespace; return this; diff --git a/src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsField.java b/src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsField.java index a06ce4645..779e2429c 100644 --- a/src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsField.java +++ b/src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsField.java @@ -17,8 +17,11 @@ public class MetadataTemplateFieldsField extends SerializableObject { * The type of field. The basic fields are a `string` field for text, a `float` field for numbers, * and a `date` fields to present the user with a date-time picker. * - *

Additionally, metadata templates support an `enum` field for a basic list of items, and ` - * multiSelect` field for a similar list of items where the user can select more than one value. + *

Additionally, metadata templates support an `enum` field for a basic list of items, and + * `multiSelect` field for a similar list of items where the user can select more than one value. + * + *

Metadata taxonomies are also supported as a `taxonomy` field type with a specific set of + * additional properties, which describe its structure. * *

**Note**: The `integer` value is deprecated. It is still present in the response, but cannot * be used in the POST request. @@ -53,6 +56,30 @@ public class MetadataTemplateFieldsField extends SerializableObject { */ protected List options; + /** + * The unique key of the metadata taxonomy to use for this taxonomy field. This property is + * required when the field `type` is set to `taxonomy`. + */ + protected String taxonomyKey; + + /** + * The unique ID of the metadata taxonomy to use for this taxonomy field. This property is + * required when the field `type` is set to `taxonomy`. + */ + protected String taxonomyId; + + /** + * The namespace of the metadata taxonomy to use for this taxonomy field. This property is + * required when the field `type` is set to `taxonomy`. + */ + protected String namespace; + + /** + * An object defining additional rules for the options of the taxonomy field. This property is + * required when the field `type` is set to `taxonomy`. + */ + protected MetadataTemplateFieldsOptionsRulesField optionsRules; + /** The unique ID of the metadata template field. */ protected String id; @@ -82,6 +109,10 @@ protected MetadataTemplateFieldsField(Builder builder) { this.description = builder.description; this.hidden = builder.hidden; this.options = builder.options; + this.taxonomyKey = builder.taxonomyKey; + this.taxonomyId = builder.taxonomyId; + this.namespace = builder.namespace; + this.optionsRules = builder.optionsRules; this.id = builder.id; markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); } @@ -110,6 +141,22 @@ public List getOptions() { return options; } + public String getTaxonomyKey() { + return taxonomyKey; + } + + public String getTaxonomyId() { + return taxonomyId; + } + + public String getNamespace() { + return namespace; + } + + public MetadataTemplateFieldsOptionsRulesField getOptionsRules() { + return optionsRules; + } + public String getId() { return id; } @@ -129,12 +176,27 @@ public boolean equals(Object o) { && Objects.equals(description, casted.description) && Objects.equals(hidden, casted.hidden) && Objects.equals(options, casted.options) + && Objects.equals(taxonomyKey, casted.taxonomyKey) + && Objects.equals(taxonomyId, casted.taxonomyId) + && Objects.equals(namespace, casted.namespace) + && Objects.equals(optionsRules, casted.optionsRules) && Objects.equals(id, casted.id); } @Override public int hashCode() { - return Objects.hash(type, key, displayName, description, hidden, options, id); + return Objects.hash( + type, + key, + displayName, + description, + hidden, + options, + taxonomyKey, + taxonomyId, + namespace, + optionsRules, + id); } @Override @@ -164,6 +226,22 @@ public String toString() { + options + '\'' + ", " + + "taxonomyKey='" + + taxonomyKey + + '\'' + + ", " + + "taxonomyId='" + + taxonomyId + + '\'' + + ", " + + "namespace='" + + namespace + + '\'' + + ", " + + "optionsRules='" + + optionsRules + + '\'' + + ", " + "id='" + id + '\'' @@ -184,6 +262,14 @@ public static class Builder extends NullableFieldTracker { protected List options; + protected String taxonomyKey; + + protected String taxonomyId; + + protected String namespace; + + protected MetadataTemplateFieldsOptionsRulesField optionsRules; + protected String id; public Builder(MetadataTemplateFieldsTypeField type, String key, String displayName) { @@ -216,6 +302,26 @@ public Builder options(List options) { return this; } + public Builder taxonomyKey(String taxonomyKey) { + this.taxonomyKey = taxonomyKey; + return this; + } + + public Builder taxonomyId(String taxonomyId) { + this.taxonomyId = taxonomyId; + return this; + } + + public Builder namespace(String namespace) { + this.namespace = namespace; + return this; + } + + public Builder optionsRules(MetadataTemplateFieldsOptionsRulesField optionsRules) { + this.optionsRules = optionsRules; + return this; + } + public Builder id(String id) { this.id = id; return this; diff --git a/src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsOptionsRulesField.java b/src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsOptionsRulesField.java new file mode 100644 index 000000000..592e2450e --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsOptionsRulesField.java @@ -0,0 +1,88 @@ +package com.box.sdkgen.schemas.metadatatemplate; + +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.fasterxml.jackson.annotation.JsonFilter; +import java.util.List; +import java.util.Objects; + +@JsonFilter("nullablePropertyFilter") +public class MetadataTemplateFieldsOptionsRulesField extends SerializableObject { + + /** Whether to allow users to select multiple values. */ + protected Boolean multiSelect; + + /** An array of integers defining which levels of the taxonomy are selectable by users. */ + protected List selectableLevels; + + public MetadataTemplateFieldsOptionsRulesField() { + super(); + } + + protected MetadataTemplateFieldsOptionsRulesField(Builder builder) { + super(); + this.multiSelect = builder.multiSelect; + this.selectableLevels = builder.selectableLevels; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public Boolean getMultiSelect() { + return multiSelect; + } + + public List getSelectableLevels() { + return selectableLevels; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MetadataTemplateFieldsOptionsRulesField casted = (MetadataTemplateFieldsOptionsRulesField) o; + return Objects.equals(multiSelect, casted.multiSelect) + && Objects.equals(selectableLevels, casted.selectableLevels); + } + + @Override + public int hashCode() { + return Objects.hash(multiSelect, selectableLevels); + } + + @Override + public String toString() { + return "MetadataTemplateFieldsOptionsRulesField{" + + "multiSelect='" + + multiSelect + + '\'' + + ", " + + "selectableLevels='" + + selectableLevels + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected Boolean multiSelect; + + protected List selectableLevels; + + public Builder multiSelect(Boolean multiSelect) { + this.multiSelect = multiSelect; + return this; + } + + public Builder selectableLevels(List selectableLevels) { + this.selectableLevels = selectableLevels; + return this; + } + + public MetadataTemplateFieldsOptionsRulesField build() { + return new MetadataTemplateFieldsOptionsRulesField(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsTypeField.java b/src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsTypeField.java index a769c13ae..e9e64ff5d 100644 --- a/src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsTypeField.java +++ b/src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsTypeField.java @@ -18,8 +18,8 @@ public enum MetadataTemplateFieldsTypeField implements Valuable { DATE("date"), ENUM("enum"), MULTISELECT("multiSelect"), - INTEGER("integer"), - TAXONOMY("taxonomy"); + TAXONOMY("taxonomy"), + INTEGER("integer"); private final String value;