Skip to content

Commit 193718a

Browse files
fix: Fix metadata template schema (box/box-openapi#596) (#1828)
Co-authored-by: Artur Jankowski <ajankowski@box.com>
1 parent 1c59b46 commit 193718a

5 files changed

Lines changed: 235 additions & 9 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": "65c9c57", "version": "10.10.0" }
1+
{ "engineHash": "c571efa", "specHash": "fa39a3f", "version": "10.10.0" }

src/main/java/com/box/sdkgen/managers/metadatatemplates/CreateMetadataTemplateRequestBodyFieldsField.java

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public class CreateMetadataTemplateRequestBodyFieldsField extends SerializableOb
1717
* The type of field. The basic fields are a `string` field for text, a `float` field for numbers,
1818
* and a `date` field to present the user with a date-time picker.
1919
*
20-
* <p>Additionally, metadata templates support an `enum` field for a basic list of items, and `
21-
* multiSelect` field for a similar list of items where the user can select more than one value.
20+
* <p>Additionally, metadata templates support an `enum` field for a basic list of items, and
21+
* `multiSelect` field for a similar list of items where the user can select more than one value.
2222
*
2323
* <p>Metadata taxonomies are also supported as a `taxonomy` field type with a specific set of
2424
* additional properties, which describe its structure.
@@ -63,6 +63,12 @@ public class CreateMetadataTemplateRequestBodyFieldsField extends SerializableOb
6363
*/
6464
protected String taxonomyKey;
6565

66+
/**
67+
* The unique ID of the metadata taxonomy to use for this taxonomy field. This property is
68+
* required when the field `type` is set to `taxonomy`.
69+
*/
70+
protected String taxonomyId;
71+
6672
/**
6773
* The namespace of the metadata taxonomy to use for this taxonomy field. This property is
6874
* required when the field `type` is set to `taxonomy`.
@@ -102,6 +108,7 @@ protected CreateMetadataTemplateRequestBodyFieldsField(Builder builder) {
102108
this.hidden = builder.hidden;
103109
this.options = builder.options;
104110
this.taxonomyKey = builder.taxonomyKey;
111+
this.taxonomyId = builder.taxonomyId;
105112
this.namespace = builder.namespace;
106113
this.optionsRules = builder.optionsRules;
107114
markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
@@ -135,6 +142,10 @@ public String getTaxonomyKey() {
135142
return taxonomyKey;
136143
}
137144

145+
public String getTaxonomyId() {
146+
return taxonomyId;
147+
}
148+
138149
public String getNamespace() {
139150
return namespace;
140151
}
@@ -160,14 +171,24 @@ public boolean equals(Object o) {
160171
&& Objects.equals(hidden, casted.hidden)
161172
&& Objects.equals(options, casted.options)
162173
&& Objects.equals(taxonomyKey, casted.taxonomyKey)
174+
&& Objects.equals(taxonomyId, casted.taxonomyId)
163175
&& Objects.equals(namespace, casted.namespace)
164176
&& Objects.equals(optionsRules, casted.optionsRules);
165177
}
166178

167179
@Override
168180
public int hashCode() {
169181
return Objects.hash(
170-
type, key, displayName, description, hidden, options, taxonomyKey, namespace, optionsRules);
182+
type,
183+
key,
184+
displayName,
185+
description,
186+
hidden,
187+
options,
188+
taxonomyKey,
189+
taxonomyId,
190+
namespace,
191+
optionsRules);
171192
}
172193

173194
@Override
@@ -201,6 +222,10 @@ public String toString() {
201222
+ taxonomyKey
202223
+ '\''
203224
+ ", "
225+
+ "taxonomyId='"
226+
+ taxonomyId
227+
+ '\''
228+
+ ", "
204229
+ "namespace='"
205230
+ namespace
206231
+ '\''
@@ -227,6 +252,8 @@ public static class Builder extends NullableFieldTracker {
227252

228253
protected String taxonomyKey;
229254

255+
protected String taxonomyId;
256+
230257
protected String namespace;
231258

232259
protected CreateMetadataTemplateRequestBodyFieldsOptionsRulesField optionsRules;
@@ -269,6 +296,11 @@ public Builder taxonomyKey(String taxonomyKey) {
269296
return this;
270297
}
271298

299+
public Builder taxonomyId(String taxonomyId) {
300+
this.taxonomyId = taxonomyId;
301+
return this;
302+
}
303+
272304
public Builder namespace(String namespace) {
273305
this.namespace = namespace;
274306
return this;

src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsField.java

Lines changed: 109 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ public class MetadataTemplateFieldsField extends SerializableObject {
1717
* The type of field. The basic fields are a `string` field for text, a `float` field for numbers,
1818
* and a `date` fields to present the user with a date-time picker.
1919
*
20-
* <p>Additionally, metadata templates support an `enum` field for a basic list of items, and `
21-
* multiSelect` field for a similar list of items where the user can select more than one value.
20+
* <p>Additionally, metadata templates support an `enum` field for a basic list of items, and
21+
* `multiSelect` field for a similar list of items where the user can select more than one value.
22+
*
23+
* <p>Metadata taxonomies are also supported as a `taxonomy` field type with a specific set of
24+
* additional properties, which describe its structure.
2225
*
2326
* <p>**Note**: The `integer` value is deprecated. It is still present in the response, but cannot
2427
* be used in the POST request.
@@ -53,6 +56,30 @@ public class MetadataTemplateFieldsField extends SerializableObject {
5356
*/
5457
protected List<MetadataTemplateFieldsOptionsField> options;
5558

59+
/**
60+
* The unique key of the metadata taxonomy to use for this taxonomy field. This property is
61+
* required when the field `type` is set to `taxonomy`.
62+
*/
63+
protected String taxonomyKey;
64+
65+
/**
66+
* The unique ID of the metadata taxonomy to use for this taxonomy field. This property is
67+
* required when the field `type` is set to `taxonomy`.
68+
*/
69+
protected String taxonomyId;
70+
71+
/**
72+
* The namespace of the metadata taxonomy to use for this taxonomy field. This property is
73+
* required when the field `type` is set to `taxonomy`.
74+
*/
75+
protected String namespace;
76+
77+
/**
78+
* An object defining additional rules for the options of the taxonomy field. This property is
79+
* required when the field `type` is set to `taxonomy`.
80+
*/
81+
protected MetadataTemplateFieldsOptionsRulesField optionsRules;
82+
5683
/** The unique ID of the metadata template field. */
5784
protected String id;
5885

@@ -82,6 +109,10 @@ protected MetadataTemplateFieldsField(Builder builder) {
82109
this.description = builder.description;
83110
this.hidden = builder.hidden;
84111
this.options = builder.options;
112+
this.taxonomyKey = builder.taxonomyKey;
113+
this.taxonomyId = builder.taxonomyId;
114+
this.namespace = builder.namespace;
115+
this.optionsRules = builder.optionsRules;
85116
this.id = builder.id;
86117
markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
87118
}
@@ -110,6 +141,22 @@ public List<MetadataTemplateFieldsOptionsField> getOptions() {
110141
return options;
111142
}
112143

144+
public String getTaxonomyKey() {
145+
return taxonomyKey;
146+
}
147+
148+
public String getTaxonomyId() {
149+
return taxonomyId;
150+
}
151+
152+
public String getNamespace() {
153+
return namespace;
154+
}
155+
156+
public MetadataTemplateFieldsOptionsRulesField getOptionsRules() {
157+
return optionsRules;
158+
}
159+
113160
public String getId() {
114161
return id;
115162
}
@@ -129,12 +176,27 @@ public boolean equals(Object o) {
129176
&& Objects.equals(description, casted.description)
130177
&& Objects.equals(hidden, casted.hidden)
131178
&& Objects.equals(options, casted.options)
179+
&& Objects.equals(taxonomyKey, casted.taxonomyKey)
180+
&& Objects.equals(taxonomyId, casted.taxonomyId)
181+
&& Objects.equals(namespace, casted.namespace)
182+
&& Objects.equals(optionsRules, casted.optionsRules)
132183
&& Objects.equals(id, casted.id);
133184
}
134185

135186
@Override
136187
public int hashCode() {
137-
return Objects.hash(type, key, displayName, description, hidden, options, id);
188+
return Objects.hash(
189+
type,
190+
key,
191+
displayName,
192+
description,
193+
hidden,
194+
options,
195+
taxonomyKey,
196+
taxonomyId,
197+
namespace,
198+
optionsRules,
199+
id);
138200
}
139201

140202
@Override
@@ -164,6 +226,22 @@ public String toString() {
164226
+ options
165227
+ '\''
166228
+ ", "
229+
+ "taxonomyKey='"
230+
+ taxonomyKey
231+
+ '\''
232+
+ ", "
233+
+ "taxonomyId='"
234+
+ taxonomyId
235+
+ '\''
236+
+ ", "
237+
+ "namespace='"
238+
+ namespace
239+
+ '\''
240+
+ ", "
241+
+ "optionsRules='"
242+
+ optionsRules
243+
+ '\''
244+
+ ", "
167245
+ "id='"
168246
+ id
169247
+ '\''
@@ -184,6 +262,14 @@ public static class Builder extends NullableFieldTracker {
184262

185263
protected List<MetadataTemplateFieldsOptionsField> options;
186264

265+
protected String taxonomyKey;
266+
267+
protected String taxonomyId;
268+
269+
protected String namespace;
270+
271+
protected MetadataTemplateFieldsOptionsRulesField optionsRules;
272+
187273
protected String id;
188274

189275
public Builder(MetadataTemplateFieldsTypeField type, String key, String displayName) {
@@ -216,6 +302,26 @@ public Builder options(List<MetadataTemplateFieldsOptionsField> options) {
216302
return this;
217303
}
218304

305+
public Builder taxonomyKey(String taxonomyKey) {
306+
this.taxonomyKey = taxonomyKey;
307+
return this;
308+
}
309+
310+
public Builder taxonomyId(String taxonomyId) {
311+
this.taxonomyId = taxonomyId;
312+
return this;
313+
}
314+
315+
public Builder namespace(String namespace) {
316+
this.namespace = namespace;
317+
return this;
318+
}
319+
320+
public Builder optionsRules(MetadataTemplateFieldsOptionsRulesField optionsRules) {
321+
this.optionsRules = optionsRules;
322+
return this;
323+
}
324+
219325
public Builder id(String id) {
220326
this.id = id;
221327
return this;
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package com.box.sdkgen.schemas.metadatatemplate;
2+
3+
import com.box.sdkgen.internal.NullableFieldTracker;
4+
import com.box.sdkgen.internal.SerializableObject;
5+
import com.fasterxml.jackson.annotation.JsonFilter;
6+
import java.util.List;
7+
import java.util.Objects;
8+
9+
@JsonFilter("nullablePropertyFilter")
10+
public class MetadataTemplateFieldsOptionsRulesField extends SerializableObject {
11+
12+
/** Whether to allow users to select multiple values. */
13+
protected Boolean multiSelect;
14+
15+
/** An array of integers defining which levels of the taxonomy are selectable by users. */
16+
protected List<Long> selectableLevels;
17+
18+
public MetadataTemplateFieldsOptionsRulesField() {
19+
super();
20+
}
21+
22+
protected MetadataTemplateFieldsOptionsRulesField(Builder builder) {
23+
super();
24+
this.multiSelect = builder.multiSelect;
25+
this.selectableLevels = builder.selectableLevels;
26+
markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
27+
}
28+
29+
public Boolean getMultiSelect() {
30+
return multiSelect;
31+
}
32+
33+
public List<Long> getSelectableLevels() {
34+
return selectableLevels;
35+
}
36+
37+
@Override
38+
public boolean equals(Object o) {
39+
if (this == o) {
40+
return true;
41+
}
42+
if (o == null || getClass() != o.getClass()) {
43+
return false;
44+
}
45+
MetadataTemplateFieldsOptionsRulesField casted = (MetadataTemplateFieldsOptionsRulesField) o;
46+
return Objects.equals(multiSelect, casted.multiSelect)
47+
&& Objects.equals(selectableLevels, casted.selectableLevels);
48+
}
49+
50+
@Override
51+
public int hashCode() {
52+
return Objects.hash(multiSelect, selectableLevels);
53+
}
54+
55+
@Override
56+
public String toString() {
57+
return "MetadataTemplateFieldsOptionsRulesField{"
58+
+ "multiSelect='"
59+
+ multiSelect
60+
+ '\''
61+
+ ", "
62+
+ "selectableLevels='"
63+
+ selectableLevels
64+
+ '\''
65+
+ "}";
66+
}
67+
68+
public static class Builder extends NullableFieldTracker {
69+
70+
protected Boolean multiSelect;
71+
72+
protected List<Long> selectableLevels;
73+
74+
public Builder multiSelect(Boolean multiSelect) {
75+
this.multiSelect = multiSelect;
76+
return this;
77+
}
78+
79+
public Builder selectableLevels(List<Long> selectableLevels) {
80+
this.selectableLevels = selectableLevels;
81+
return this;
82+
}
83+
84+
public MetadataTemplateFieldsOptionsRulesField build() {
85+
return new MetadataTemplateFieldsOptionsRulesField(this);
86+
}
87+
}
88+
}

src/main/java/com/box/sdkgen/schemas/metadatatemplate/MetadataTemplateFieldsTypeField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public enum MetadataTemplateFieldsTypeField implements Valuable {
1818
DATE("date"),
1919
ENUM("enum"),
2020
MULTISELECT("multiSelect"),
21-
INTEGER("integer"),
22-
TAXONOMY("taxonomy");
21+
TAXONOMY("taxonomy"),
22+
INTEGER("integer");
2323

2424
private final String value;
2525

0 commit comments

Comments
 (0)