Skip to content

Commit a8284eb

Browse files
authored
Add allow dynamic list to List Metadata field
1 parent 4e7d91f commit a8284eb

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

cloudinary-core/src/main/java/com/cloudinary/metadata/MetadataField.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class MetadataField<T> extends JSONObject {
1818
public static final String VALIDATION = "validation";
1919
public static final String RESTRICTIONS = "restrictions";
2020
public static final String DEFAULT_DISABLED = "default_disabled";
21+
public static final String ALLOW_DYNAMIC_LIST_VALUES = "allow_dynamic_list_values";
2122

2223
public MetadataField(MetadataFieldType type) {
2324
put(TYPE, type.toString());
@@ -148,4 +149,10 @@ public void setRestrictions(Restrictions restrictions) {
148149
public void setDefaultDisabled(Boolean disabled) {
149150
put(DEFAULT_DISABLED, disabled);
150151
}
152+
153+
/**
154+
* Set the value indicating whether the dynamic list values should allow
155+
* @param allowDynamicListValues The value to set.
156+
*/
157+
public void setAllowDynamicListValues(Boolean allowDynamicListValues) {put(ALLOW_DYNAMIC_LIST_VALUES, allowDynamicListValues);}
151158
}

cloudinary-test-common/src/main/java/com/cloudinary/test/AbstractStructuredMetadataTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ public void testCreateMetadata() throws Exception {
7373
assertEquals(setField.getLabel(), result.get("label"));
7474
}
7575

76+
@Test
77+
public void testCreateSetMetadataWithAllowDynamicListValues() throws Exception {
78+
SetMetadataField setField = createSetField("testCreateMetadata_2");
79+
ApiResponse result = cloudinary.api().addMetadataField(setField);
80+
assertNotNull(result);
81+
assertEquals(setField.getLabel(), result.get("label"));
82+
assertEquals(true, result.get("allow_dynamic_list_values"));
83+
}
84+
7685
@Test
7786
public void testFieldRestrictions() throws Exception {
7887
StringMetadataField stringField = newFieldInstance("testCreateMetadata_3", true);
@@ -367,6 +376,7 @@ private SetMetadataField createSetField(String labelPrefix) {
367376
String label = labelPrefix + "_" + SUFFIX;
368377
setField.setLabel(label);
369378
setField.setMandatory(false);
379+
setField.setAllowDynamicListValues(true);
370380
setField.setValidation(new MetadataValidation.StringLength(3, 99));
371381
setField.setDefaultValue(Arrays.asList("id2", "id3"));
372382
setField.setValidation(null);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy