diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/ButtonImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/ButtonImpl.java index 4ddcbed940..11d84d0fc6 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/ButtonImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/ButtonImpl.java @@ -37,6 +37,7 @@ import com.adobe.cq.forms.core.components.internal.form.FormConstants; import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; import com.adobe.cq.forms.core.components.models.form.Button; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.util.AbstractBaseImpl; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -87,6 +88,11 @@ public String getButtonType() { return buttonType; } + @Override + public String getFieldType() { + return super.getFieldType(FieldType.BUTTON); + } + @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = ReservedProperties.PN_DOR_EXCLUSION) @Default(booleanValues = false) protected boolean dorExclusion; diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxGroupImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxGroupImpl.java index 33869596c9..e82837fbcb 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxGroupImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxGroupImpl.java @@ -34,6 +34,7 @@ import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; import com.adobe.cq.forms.core.components.models.form.CheckBox; import com.adobe.cq.forms.core.components.models.form.CheckBoxGroup; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.util.AbstractOptionsFieldImpl; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -83,4 +84,9 @@ public Integer getMaxItems() { public Type getType() { return super.getType(); // check box group always has type array // we always return boolean[], string[] or number[] } + + @Override + public String getFieldType() { + return super.getFieldType(FieldType.CHECKBOX_GROUP); + } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImpl.java index 8dfa4d4bd1..205cc2fead 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImpl.java @@ -36,6 +36,7 @@ import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; import com.adobe.cq.forms.core.components.models.form.ConstraintType; import com.adobe.cq.forms.core.components.models.form.DatePicker; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.util.AbstractFieldImpl; import com.adobe.cq.forms.core.components.util.ComponentUtils; @@ -83,6 +84,11 @@ public Date getExclusiveMinimumDate() { return ComponentUtils.clone(exclusiveMinimumVaue); } + @Override + public String getFieldType() { + return super.getFieldType(FieldType.DATE_INPUT); + } + public @NotNull Map getConstraintMessages() { Map res = super.getConstraintMessages(); String msg = getConstraintMessage(ConstraintType.MINIMUM); diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DropDownImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DropDownImpl.java index 0f7e5f1e50..fb3a61dca6 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DropDownImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DropDownImpl.java @@ -28,6 +28,7 @@ import com.adobe.cq.forms.core.components.internal.form.FormConstants; import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; import com.adobe.cq.forms.core.components.models.form.DropDown; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.util.AbstractOptionsFieldImpl; @Model( @@ -56,4 +57,9 @@ public Integer getMaxItems() { public Boolean isMultiSelect() { return multiSelect; } + + @Override + public String getFieldType() { + return super.getFieldType(FieldType.DROP_DOWN); + } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FileInputImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FileInputImpl.java index 145eb030bc..4e059e97b0 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FileInputImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FileInputImpl.java @@ -34,6 +34,7 @@ import com.adobe.cq.export.json.ExporterConstants; import com.adobe.cq.forms.core.components.internal.form.FormConstants; import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.FileInput; import com.adobe.cq.forms.core.components.util.AbstractFieldImpl; @@ -79,6 +80,11 @@ public Type getType() { } } + @Override + public String getFieldType() { + return super.getFieldType(FieldType.FILE_INPUT); + } + @Override public Boolean isMultiple() { return multiSelection; diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImpl.java index 6cf3451b0b..379c78298e 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImpl.java @@ -30,6 +30,7 @@ import com.adobe.cq.export.json.ExporterConstants; import com.adobe.cq.forms.core.components.internal.form.FormConstants; import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.NumberInput; import com.adobe.cq.forms.core.components.util.AbstractFieldImpl; import com.adobe.cq.forms.core.components.util.ComponentUtils; @@ -129,6 +130,11 @@ public Type getType() { } } + @Override + public String getFieldType() { + return super.getFieldType(FieldType.NUMBER_INPUT); + } + @PostConstruct private void initNumberInput() { Object tempExclusiveMaximumValue = ComponentUtils.getExclusiveValue(exclusiveMaximum, maximumAsStr != null ? maximumAsStr : maximum, diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PanelImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PanelImpl.java index be456b6ce1..b066e38587 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PanelImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PanelImpl.java @@ -32,6 +32,7 @@ import com.adobe.cq.export.json.ExporterConstants; import com.adobe.cq.forms.core.components.internal.form.FormConstants; import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.Panel; import com.adobe.cq.forms.core.components.util.AbstractContainerImpl; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -107,6 +108,11 @@ public Type getType() { return null; } + @Override + public String getFieldType() { + return super.getFieldType(FieldType.PANEL); + } + @Override @JsonInclude(JsonInclude.Include.NON_NULL) @Nullable diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RadioButtonImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RadioButtonImpl.java index 86dcb441c1..28318f8f1f 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RadioButtonImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RadioButtonImpl.java @@ -32,6 +32,7 @@ import com.adobe.cq.export.json.ExporterConstants; import com.adobe.cq.forms.core.components.internal.form.FormConstants; import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.RadioButton; import com.adobe.cq.forms.core.components.util.AbstractOptionsFieldImpl; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -68,4 +69,9 @@ private void initRadioButtonModel() { public Orientation getOrientation() { return orientation; } + + @Override + public String getFieldType() { + return super.getFieldType(FieldType.RADIO_GROUP); + } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImpl.java index b888b428fc..d2fb4b4c1a 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImpl.java @@ -34,6 +34,7 @@ import com.adobe.cq.export.json.ExporterConstants; import com.adobe.cq.forms.core.components.internal.form.FormConstants; import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.StaticImage; import com.adobe.cq.forms.core.components.util.AbstractFormComponentImpl; import com.day.cq.wcm.foundation.Image; @@ -138,4 +139,9 @@ public String getLinkUrl() { } return properties; } + + @Override + public String getFieldType() { + return super.getFieldType(FieldType.IMAGE); + } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextImpl.java index e2ea56ae21..44b7cf71fa 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextImpl.java @@ -28,6 +28,7 @@ import com.adobe.cq.export.json.ExporterConstants; import com.adobe.cq.forms.core.components.internal.form.FormConstants; import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.Text; import com.adobe.cq.forms.core.components.util.AbstractFormComponentImpl; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -69,4 +70,9 @@ public boolean isRichText() { public String getText() { return getValue(); } + + @Override + public String getFieldType() { + return super.getFieldType(FieldType.PLAIN_TEXT); + } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImpl.java index 85ea7efcff..150f6bc9fc 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImpl.java @@ -79,9 +79,8 @@ public boolean isMultiLine() { public String getFieldType() { if (isMultiLine()) { return FieldType.MULTILINE_INPUT.getValue(); - } else { - return super.getFieldType(); } + return super.getFieldType(FieldType.TEXT_INPUT); } @Override diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java index ed89546728..12a7ebbfdb 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java @@ -49,6 +49,7 @@ import com.adobe.cq.forms.core.components.internal.models.v1.form.FormMetaDataImpl; import com.adobe.cq.forms.core.components.models.form.AutoSaveConfiguration; import com.adobe.cq.forms.core.components.models.form.Container; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.FormClientLibManager; import com.adobe.cq.forms.core.components.models.form.FormContainer; import com.adobe.cq.forms.core.components.models.form.FormMetaData; @@ -124,6 +125,11 @@ public class FormContainerImpl extends AbstractContainerImpl implements FormCont @Self(injectionStrategy = InjectionStrategy.OPTIONAL) private AutoSaveConfiguration autoSaveConfig; + @Override + public String getFieldType() { + return super.getFieldType(FieldType.FORM); + } + @PostConstruct protected void initFormContainerModel() { if (request != null) { diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/TitleImplV2.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/TitleImplV2.java index 0ea56923be..7c47ed49ad 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/TitleImplV2.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/TitleImplV2.java @@ -35,6 +35,7 @@ import com.adobe.cq.forms.core.components.internal.Heading; import com.adobe.cq.forms.core.components.internal.form.FormConstants; import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.FormTitle; import com.adobe.cq.forms.core.components.util.AbstractFormComponentImpl; import com.adobe.cq.forms.core.components.util.ComponentUtils; @@ -69,6 +70,11 @@ public class TitleImplV2 extends AbstractFormComponentImpl implements FormTitle private Heading heading; + @Override + public String getFieldType() { + return super.getFieldType(FieldType.PLAIN_TEXT); + } + /** * Translation of the title property */ diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java index fb357d8b17..ff9472c031 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java @@ -35,7 +35,10 @@ public enum FieldType { PANEL("panel"), FORM("form"), CHECKBOX_GROUP("checkbox-group"), - IMAGE("image"); + IMAGE("image"), + TELEPHONE("tel"), + PASSWORD("password"), + RANGE("range"); private String value; diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormContainer.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormContainer.java index 71e8c53fa7..ef08b70512 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormContainer.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormContainer.java @@ -64,7 +64,7 @@ public interface FormContainer extends Container { */ String PN_CLIENT_LIB_REF = GuideConstants.CLIENT_LIB_REF; - String DEFAULT_FORMS_SPEC_VERSION = "0.14.0"; + String DEFAULT_FORMS_SPEC_VERSION = "0.14.1"; /** * Returns form metadata {@link FormMetaData} diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractCaptchaImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractCaptchaImpl.java index f3b9011bd1..0a34746ea6 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractCaptchaImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractCaptchaImpl.java @@ -20,6 +20,7 @@ import com.adobe.aemds.guide.service.GuideException; import com.adobe.cq.forms.core.components.models.form.Captcha; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.fasterxml.jackson.annotation.JsonIgnore; /** @@ -31,6 +32,11 @@ public abstract class AbstractCaptchaImpl extends AbstractFieldImpl implements C @JsonIgnore public abstract String getProvider(); + @Override + public String getFieldType() { + return super.getFieldType(FieldType.CAPTCHA); + } + public abstract Map getCaptchaProperties(); public Map getProperties() { diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractCheckboxImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractCheckboxImpl.java index 1b741011e7..6ea1c9dfac 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractCheckboxImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractCheckboxImpl.java @@ -22,6 +22,7 @@ import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; import com.adobe.cq.forms.core.components.models.form.Base; +import com.adobe.cq.forms.core.components.models.form.FieldType; /** * Abstract class which can be used as base class for {@link Base} implementations. @@ -57,4 +58,9 @@ public Object[] getEnums() { return ComponentUtils.coerce(type, enums); } } + + @Override + public String getFieldType() { + return super.getFieldType(FieldType.CHECKBOX); + } } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractFormComponentImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractFormComponentImpl.java index 50f3a643d5..723c9eec9a 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractFormComponentImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractFormComponentImpl.java @@ -78,7 +78,7 @@ public class AbstractFormComponentImpl extends AbstractComponentImpl implements protected String dataRef; // mandatory property else adapt should fail for adaptive form components - @ValueMapValue(name = ReservedProperties.PN_FIELDTYPE) + @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = ReservedProperties.PN_FIELDTYPE) protected String fieldTypeJcr; private FieldType fieldType; @@ -148,7 +148,9 @@ public class AbstractFormComponentImpl extends AbstractComponentImpl implements @PostConstruct protected void initBaseModel() { // first check if this is in the supported list of field type - fieldType = FieldType.fromString(fieldTypeJcr); + if (StringUtils.isNotEmpty(fieldTypeJcr)) { + fieldType = FieldType.fromString(fieldTypeJcr); + } if (request != null && i18n == null) { i18n = GuideUtils.getI18n(request, resource); } @@ -216,6 +218,13 @@ public String getFieldType() { return fieldType.getValue(); } + protected String getFieldType(@Nonnull FieldType defaultFieldType) { + if (fieldType == null) { + return defaultFieldType.getValue(); + } + return fieldType.getValue(); + } + /** * Returns {@code true} if form field should be visible, otherwise {@code false}. * diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/Utils.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/Utils.java index 1122530f09..bc5d28351e 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/Utils.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/Utils.java @@ -125,14 +125,14 @@ public static void testSchemaValidation(@NotNull Object model) { // create an instance of the JsonSchemaFactory using version flag JsonSchemaFactory schemaFactory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7); try { - InputStream schemaStream = Utils.class.getResourceAsStream("/schema/0.14.0/adaptive-form.schema.json"); + InputStream schemaStream = Utils.class.getResourceAsStream("/schema/0.14.1/adaptive-form.schema.json"); JsonSchema schema = schemaFactory.getSchema(schemaStream); // read data from the stream and store it into JsonNode JsonNode json = objectMapper.readTree(jsonStream); // if there is a version bump of schema, then it needs to be validated against its corresponding sling model here // by explicitly checking the model implementation if (!(model instanceof FormContainerImpl)) { - InputStream formContainerTemplate = Utils.class.getResourceAsStream("/schema/0.14.0/form.json"); + InputStream formContainerTemplate = Utils.class.getResourceAsStream("/schema/0.14.1/form.json"); JsonNode formContainerTemplateNode = objectMapper.readTree(formContainerTemplate); ((ObjectNode) formContainerTemplateNode).putArray("items").add(json); json = formContainerTemplateNode; diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/ButtonImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/ButtonImplTest.java index 526794d5ca..cd6d9cda37 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/ButtonImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/ButtonImplTest.java @@ -35,6 +35,7 @@ public class ButtonImplTest { private static final String CONTENT_ROOT = "/content"; private static final String PATH_BUTTON_1 = CONTENT_ROOT + "/button"; private static final String PATH_BUTTON_CUSTOMIZED = CONTENT_ROOT + "/button-customized"; + private static final String PATH_BUTTON_NO_FIELDTYPE = CONTENT_ROOT + "/button-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @BeforeEach @@ -141,4 +142,10 @@ void testGetProperties() { Button button = Utils.getComponentUnderTest(PATH_BUTTON_1, Button.class, context); assertEquals("button", button.getProperties().get("fd:buttonType")); } + + @Test + void testNoFieldType() { + Button button = Utils.getComponentUnderTest(PATH_BUTTON_NO_FIELDTYPE, Button.class, context); + assertEquals(FieldType.BUTTON.getValue(), button.getFieldType()); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxGroupImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxGroupImplTest.java index 3d4eb5bc59..867415de31 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxGroupImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxGroupImplTest.java @@ -55,8 +55,8 @@ public class CheckBoxGroupImplTest { private static final String PATH_CHECKBOX_GROUP_WITH_DUPLICATE_ENUMS = CONTENT_ROOT + "/checkboxgroup-duplicate-enum"; private static final String PATH_CHECKBOX_GROUP_FOR_INSERTION_ORDER = CONTENT_ROOT + "/checkboxgroup-insertion-order"; - private static final String PATH_CHECKBOX_GROUP_FOR_BOOLEAN = CONTENT_ROOT + "/checkboxgroup-boolean"; + private static final String PATH_CHECKBOX_GROUP_NO_FIELDTYPE = CONTENT_ROOT + "/checkboxgroup-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -387,4 +387,10 @@ void testInsertionOrderForEnumNames() { "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen", "Twenty")); assertArrayEquals(set.toArray(new String[0]), checkboxGroup.getEnumNames()); } + + @Test + void testNoFieldType() { + CheckBoxGroup checkboxGroup = getCheckBoxGroupUnderTest(PATH_CHECKBOX_GROUP_NO_FIELDTYPE); + Utils.testJSONExport(checkboxGroup, Utils.getTestExporterJSONPath(BASE, PATH_CHECKBOX_GROUP_NO_FIELDTYPE)); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxImplTest.java index 547743b9b9..8c02944da5 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/CheckBoxImplTest.java @@ -57,6 +57,7 @@ public class CheckBoxImplTest { private static final String PATH_CHECKBOX_NOENUM = CONTENT_ROOT + "/checkboxNoEnum"; private static final String PATH_CHECKBOX_ENABLEUNCHECKEDOFF = CONTENT_ROOT + "/checkbox-enableUncheckedValueFalse"; + private static final String PATH_CHECKBOX_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/checkbox-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @BeforeEach @@ -354,4 +355,10 @@ private CheckBox getCheckBoxUnderTest(String resourcePath) { MockSlingHttpServletRequest request = context.request(); return request.adaptTo(CheckBox.class); } + + @Test + void testNoFieldType() { + CheckBox checkbox = getCheckBoxUnderTest(PATH_CHECKBOX_WITHOUT_FIELDTYPE); + Utils.testJSONExport(checkbox, Utils.getTestExporterJSONPath(BASE, PATH_CHECKBOX_WITHOUT_FIELDTYPE)); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImplTest.java index d7ff283a62..921195f475 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DatePickerImplTest.java @@ -48,6 +48,7 @@ public class DatePickerImplTest { private static final String PATH_DATEPICKER_DATALAYER = CONTENT_ROOT + "/datepicker-datalayer"; private static final String PATH_DATEPICKER_DISPLAY_VALUE_EXPRESSION = CONTENT_ROOT + "/datepicker-displayValueExpression"; private static final String PATH_DATEPICKER_BACKWARD_COMPATIBLE = CONTENT_ROOT + "/datepicker-backwardcompatible"; + private static final String PATH_DATEPICKER_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/datepicker-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -306,4 +307,10 @@ void testJSONExportForDisplayValueExpression() throws Exception { DatePicker datePicker = Utils.getComponentUnderTest(PATH_DATEPICKER_DISPLAY_VALUE_EXPRESSION, DatePicker.class, context); Utils.testJSONExport(datePicker, Utils.getTestExporterJSONPath(BASE, PATH_DATEPICKER_DISPLAY_VALUE_EXPRESSION)); } + + @Test + void testNoFieldType() throws Exception { + DatePicker datePicker = Utils.getComponentUnderTest(PATH_DATEPICKER_WITHOUT_FIELDTYPE, DatePicker.class, context); + Utils.testJSONExport(datePicker, Utils.getTestExporterJSONPath(BASE, PATH_DATEPICKER_WITHOUT_FIELDTYPE)); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DropDownImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DropDownImplTest.java index aa11d3e64e..488c08d989 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DropDownImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/DropDownImplTest.java @@ -64,6 +64,7 @@ public class DropDownImplTest { private static final String PATH_DROPDOWN_FOR_NO_ENUM_NAMES = CONTENT_ROOT + "/dropdown-without-enumNames"; private static final String PATH_DROPDOWN_FOR_LESSER_ENUM_NAMES = CONTENT_ROOT + "/dropdown-with-lesser-enumNames"; private static final String PATH_DROPDOWN_FOR_EXTRA_ENUM_NAMES = CONTENT_ROOT + "/dropdown-with-extra-enumNames"; + private static final String PATH_DROPDOWN_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/dropdown-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -465,4 +466,10 @@ void testEnumsWithExtraEnumNames() { Set set2 = new LinkedHashSet<>(Arrays.asList("zero", "one")); assertArrayEquals(set2.toArray(new String[0]), dropdown2.getEnumNames()); } + + @Test + void testNoFieldType() { + DropDown dropdown = Utils.getComponentUnderTest(PATH_DROPDOWN_WITHOUT_FIELDTYPE, DropDown.class, context); + Utils.testJSONExport(dropdown, Utils.getTestExporterJSONPath(BASE, PATH_DROPDOWN_WITHOUT_FIELDTYPE)); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FileInputImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FileInputImplTest.java index 916dcec027..3de57ce01e 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FileInputImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FileInputImplTest.java @@ -59,6 +59,7 @@ public class FileInputImplTest { private static final String PATH_FILEINPUT_DATALAYER = CONTENT_ROOT + "/fileinput-datalayer"; private static final String PATH_MULTISELECT_FILEINPUT = CONTENT_ROOT + "/multiselect-fileinput"; private static final String PATH_MULTISELECT_FILEINPUT_WITHNOTYPE = CONTENT_ROOT + "/multiselect-fileinput-withNoType"; + private static final String PATH_FILEINPUT_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/fileinput-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -400,4 +401,10 @@ void testJSONExportDataLayer() throws Exception { FieldUtils.writeField(fileInput, "dataLayerEnabled", true, true); Utils.testJSONExport(fileInput, Utils.getTestExporterJSONPath(BASE, PATH_FILEINPUT_DATALAYER)); } + + @Test + void testNoFieldType() { + FileInput fileInput = Utils.getComponentUnderTest(PATH_FILEINPUT_WITHOUT_FIELDTYPE, FileInput.class, context); + Utils.testJSONExport(fileInput, Utils.getTestExporterJSONPath(BASE, PATH_FILEINPUT_WITHOUT_FIELDTYPE)); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FragmentImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FragmentImplTest.java index d570daf1d6..ec4b4ec85f 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FragmentImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FragmentImplTest.java @@ -34,6 +34,7 @@ import com.adobe.cq.export.json.SlingModelFilter; import com.adobe.cq.forms.core.Utils; import com.adobe.cq.forms.core.components.internal.form.FormConstants; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.FormClientLibManager; import com.adobe.cq.forms.core.components.models.form.Fragment; import com.adobe.cq.forms.core.components.models.form.TextInput; @@ -53,6 +54,7 @@ public class FragmentImplTest { private static final String CONTENT_ROOT = "/content"; private static final String PATH_FRAGMENT = CONTENT_ROOT + "/fragment"; private static final String PATH_FRAGMENT_DAMPATH = CONTENT_ROOT + "/fragment-dampath"; + private static final String PATH_FRAGMENT_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/fragment-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @BeforeEach @@ -185,4 +187,10 @@ public void testAddClientLibRef() { List clientLibs = formClientLibManager.getClientLibRefList(); assertEquals(1, clientLibs.size()); } + + @Test + void testNoFieldType() { + Fragment fragment = Utils.getComponentUnderTest(PATH_FRAGMENT_WITHOUT_FIELDTYPE, Fragment.class, context); + assertEquals(FieldType.PANEL.getValue(), fragment.getFieldType()); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/HCaptchaImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/HCaptchaImplTest.java index 7d2a235ada..db4f39e00a 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/HCaptchaImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/HCaptchaImplTest.java @@ -42,6 +42,7 @@ public class HCaptchaImplTest { private static final String BASE = "/form/hcaptcha"; private static final String CONTENT_ROOT = "/content"; private static final String PATH_HCAPTCHA = CONTENT_ROOT + "/hcaptcha"; + private static final String PATH_HCAPTCHA_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/hcaptcha-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -137,4 +138,10 @@ void hCaptchaConfigExceptionTest() throws GuideException { HCaptcha hcaptcha = Utils.getComponentUnderTest(PATH_HCAPTCHA, HCaptcha.class, context); assertNotNull(hcaptcha.getCaptchaProperties()); } + + @Test + void testNoFieldType() { + HCaptcha hCaptcha = Utils.getComponentUnderTest(PATH_HCAPTCHA_WITHOUT_FIELDTYPE, HCaptcha.class, context); + assertEquals(FieldType.CAPTCHA.getValue(), hCaptcha.getFieldType()); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java index 8e633a7b6c..4fba10fe65 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/NumberInputImplTest.java @@ -57,8 +57,8 @@ public class NumberInputImplTest { private static final String PATH_NUMBER_INPUT_BACKWARD_COMPATIBLE_STRING = CONTENT_ROOT + "/numberinput-backwardcompatible-string"; private static final String PATH_NUMBER_INPUT = CONTENT_ROOT + "/numberinput"; private static final String PATH_NUMBER_INPUT_DATALAYER = CONTENT_ROOT + "/numberinput-datalayer"; - private static final String PATH_NUMBER_INPUT_DISPLAY_VALUE_EXPRESSION = CONTENT_ROOT + "/numberinput-displayvalueExpression"; + private static final String PATH_NUMBER_INPUT_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/numberinput-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -423,4 +423,9 @@ void testJSONExportForDisplayValueExpression() throws Exception { Utils.testJSONExport(numberInput, Utils.getTestExporterJSONPath(BASE, PATH_NUMBER_INPUT_DISPLAY_VALUE_EXPRESSION)); } + @Test + void testNoFieldType() { + NumberInput numberInput = Utils.getComponentUnderTest(PATH_NUMBER_INPUT_WITHOUT_FIELDTYPE, NumberInput.class, context); + assertEquals(FieldType.NUMBER_INPUT.getValue(), numberInput.getFieldType()); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PanelImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PanelImplTest.java index 5637013b68..506291c089 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PanelImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PanelImplTest.java @@ -30,6 +30,7 @@ import com.adobe.cq.export.json.SlingModelFilter; import com.adobe.cq.forms.core.Utils; import com.adobe.cq.forms.core.components.internal.form.FormConstants; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.Panel; import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext; import com.day.cq.wcm.api.NameConstants; @@ -48,6 +49,7 @@ public class PanelImplTest { private static final String PATH_ARRAY_PANEL = CONTENT_ROOT + "/array-panel"; private static final String PATH_RULES_PANEL = CONTENT_ROOT + "/rules-panel"; private static final String PATH_BOUND_PANEL = CONTENT_ROOT + "/bound-panel"; + private static final String PATH_PANEL_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/panel-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @BeforeEach @@ -129,4 +131,10 @@ void testBoundPanelJSONExport() throws Exception { Panel panel = Utils.getComponentUnderTest(PATH_BOUND_PANEL, Panel.class, context); Utils.testJSONExport(panel, Utils.getTestExporterJSONPath(BASE, PATH_BOUND_PANEL)); } + + @Test + void testNoFieldType() { + Panel panel = Utils.getComponentUnderTest(PATH_PANEL_WITHOUT_FIELDTYPE, Panel.class, context); + assertEquals(FieldType.PANEL.getValue(), panel.getFieldType()); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RadioButtonImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RadioButtonImplTest.java index 7506d2deea..c2048cb14a 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RadioButtonImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RadioButtonImplTest.java @@ -53,6 +53,7 @@ public class RadioButtonImplTest { private static final String PATH_RADIOBUTTON_WITH_DUPLICATE_ENUMS = CONTENT_ROOT + "/radiobutton-duplicate-enum"; private static final String PATH_RADIOBUTTON_FOR_INSERTION_ORDER = CONTENT_ROOT + "/radiobutton-insertion-order"; + private static final String PATH_RADIOBUTTON_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/radiobutton-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -420,4 +421,10 @@ void testGetScreenReaderTextWithDescription() { Mockito.when(radioButtonMock.getScreenReaderText()).thenCallRealMethod(); assertEquals(null, radioButtonMock.getScreenReaderText()); } + + @Test + void testNoFieldType() { + RadioButton radioButton = getRadioButtonUnderTest(PATH_RADIOBUTTON_WITHOUT_FIELDTYPE); + assertEquals(FieldType.RADIO_GROUP.getValue(), radioButton.getFieldType()); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RecaptchaImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RecaptchaImplTest.java index 3f276141f0..876f798ad5 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RecaptchaImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/RecaptchaImplTest.java @@ -43,6 +43,7 @@ public class RecaptchaImplTest { private static final String BASE = "/form/recaptcha"; private static final String CONTENT_ROOT = "/content"; private static final String PATH_RECAPTCHA = CONTENT_ROOT + "/recaptcha"; + private static final String PATH_RECAPTCHA_WITHOUT_FEILDTYPE = CONTENT_ROOT + "/recaptcha-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -140,4 +141,10 @@ void getEnterpriseUrl() { String enterpriseUrl = (String) captchaProps.get("uri"); assertEquals("https://www.recaptcha.net/recaptcha/enterprise.js", enterpriseUrl); } + + @Test + void testNoFieldType() { + Captcha recaptcha = Utils.getComponentUnderTest(PATH_RECAPTCHA_WITHOUT_FEILDTYPE, Captcha.class, context); + assertEquals(FieldType.CAPTCHA.getValue(), recaptcha.getFieldType()); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImplTest.java index b033d55f58..0eb7c57208 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImplTest.java @@ -52,6 +52,7 @@ public class StaticImageImplTest { private static final String PATH_IMAGE_PARSED = CONTENT_ROOT + "/image-parsedSrc"; private static final String PATH_IMAGE = CONTENT_ROOT + "/image"; private static final String PATH_IMAGE_DATALAYER = CONTENT_ROOT + "/image-datalayer"; + private static final String PATH_IMAGE_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/image-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -208,4 +209,10 @@ void testJSONExportForDatalayer() throws Exception { FieldUtils.writeField(image, "dataLayerEnabled", true, true); Utils.testJSONExport(image, Utils.getTestExporterJSONPath(BASE, PATH_IMAGE_DATALAYER)); } + + @Test + void testNoFieldType() { + StaticImage image = Utils.getComponentUnderTest(PATH_IMAGE_WITHOUT_FIELDTYPE, StaticImage.class, context); + assertEquals(FieldType.IMAGE.getValue(), image.getFieldType()); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/SwitchImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/SwitchImplTest.java index 80fac1ef6d..7234994ea8 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/SwitchImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/SwitchImplTest.java @@ -48,6 +48,7 @@ public class SwitchImplTest { private static final String PATH_SWITCH_ENABLEUNCHECKEDOFF = CONTENT_ROOT + "/switch-enableUncheckedValueFalse"; private static final String PATH_SWITCH_ENABLEUNCHECKED_BOOLEAN = CONTENT_ROOT + "/switch-boolean"; private static final String PATH_SWITCH_ENABLEUNCHECKEDOFF_BOOLEAN = CONTENT_ROOT + "/switch-enableUncheckedValueFalse-boolean"; + private static final String PATH_SWITCH_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/switch-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @BeforeEach @@ -344,4 +345,10 @@ private Switch getSwitchUnderTest(String resourcePath) { MockSlingHttpServletRequest request = context.request(); return request.adaptTo(Switch.class); } + + @Test + void testNoFieldType() { + Switch switchComp = getSwitchUnderTest(PATH_SWITCH_WITHOUT_FIELDTYPE); + assertEquals(FieldType.CHECKBOX.getValue(), switchComp.getFieldType()); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImplTest.java index 57c936958b..228abc2260 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImplTest.java @@ -31,6 +31,7 @@ import com.adobe.cq.export.json.SlingModelFilter; import com.adobe.cq.forms.core.Utils; import com.adobe.cq.forms.core.components.internal.form.FormConstants; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.TermsAndConditions; import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext; import com.day.cq.wcm.api.NameConstants; @@ -49,6 +50,7 @@ public class TermsAndConditionsImplTest { private static final String PATH_TNC = CONTENT_ROOT + "/termsandconditions"; private static final String PATH_NOWRAP_TNC = CONTENT_ROOT + "/termsandconditionsNoWrapData"; + private static final String PATH_TNC_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/termsandconditions-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -123,4 +125,10 @@ void testNoWrap() { TermsAndConditions tnc = Utils.getComponentUnderTest(PATH_NOWRAP_TNC, TermsAndConditions.class, context); Assert.assertNull(tnc.getType()); } + + @Test + void testNoFieldType() { + TermsAndConditions tnc = Utils.getComponentUnderTest(PATH_TNC_WITHOUT_FIELDTYPE, TermsAndConditions.class, context); + assertEquals(FieldType.PANEL.getValue(), tnc.getFieldType()); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextImplTest.java index f76a6d4dc5..b2cc0b4a96 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextImplTest.java @@ -39,6 +39,7 @@ public class TextImplTest { private static final String PATH_TEXT_CUSTOMIZED = CONTENT_ROOT + "/text-customized"; private static final String PATH_TEXT = CONTENT_ROOT + "/text"; private static final String PATH_TEXT_DATALAYER = CONTENT_ROOT + "/text-datalayer"; + private static final String PATH_TEXT_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/text-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -153,4 +154,10 @@ void testDorProperties() { assertEquals(true, textImpl.getDorProperties().get("dorExclusion")); assertEquals("4", textImpl.getDorProperties().get("dorColspan")); } + + @Test + void testNoFieldType() { + TextImpl text = Utils.getComponentUnderTest(PATH_TEXT_WITHOUT_FIELDTYPE, TextImpl.class, context); + assertEquals(FieldType.PLAIN_TEXT.getValue(), text.getFieldType()); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImplTest.java index b44e97d2a8..44ddd794a2 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TextInputImplTest.java @@ -63,6 +63,7 @@ public class TextInputImplTest { private static final String PATH_TEXTINPUT_DISPLAY_VALUE_EXPRESSION = CONTENT_ROOT + "/textinput-displayValueExpression"; private static final String PATH_TEXTINPUT_PLACEHOLDER_AUTOCOMPLETE = CONTENT_ROOT + "/textinput-placeholder-autocomplete"; private static final String PATH_TEXTINPUT_WITH_VIEWTYPE = CONTENT_ROOT + "/textinput-with-viewtype"; + private static final String PATH_TEXTINPUT_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/textinput-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -510,4 +511,10 @@ void testExportTypeWithViewType() throws Exception { Utils.testJSONExport(textInput, Utils.getTestExporterJSONPath(BASE, PATH_TEXTINPUT_WITH_VIEWTYPE)); assertEquals("some/custom/value", textInput.getExportedType()); } + + @Test + void testNoFieldType() { + TextInput textInput = Utils.getComponentUnderTest(PATH_TEXTINPUT_WITHOUT_FIELDTYPE, TextInput.class, context); + assertEquals(FieldType.TEXT_INPUT.getValue(), textInput.getFieldType()); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/WizardImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/WizardImplTest.java index 38e912e5a5..d4b501c07b 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/WizardImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/WizardImplTest.java @@ -23,11 +23,13 @@ import java.util.stream.StreamSupport; import org.apache.sling.api.resource.Resource; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import com.adobe.cq.export.json.SlingModelFilter; import com.adobe.cq.forms.core.Utils; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.Panel; import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext; import com.day.cq.wcm.api.NameConstants; @@ -35,16 +37,19 @@ import io.wcm.testing.mock.aem.junit5.AemContext; import io.wcm.testing.mock.aem.junit5.AemContextExtension; +import static org.junit.Assert.assertEquals; + @ExtendWith(AemContextExtension.class) public class WizardImplTest { private static final String BASE = "/form/wizard"; private static final String CONTENT_ROOT = "/content"; private static final String PATH_WIZARD = CONTENT_ROOT + "/wizard"; + private static final String PATH_WIZARD_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/wizard-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); - @Test - void testGetExportedItems() throws Exception { + @BeforeEach + void setUp() { context.load().json(BASE + FormsCoreComponentTestContext.TEST_CONTENT_JSON, CONTENT_ROOT); context.registerService(SlingModelFilter.class, new SlingModelFilter() { @@ -69,8 +74,17 @@ public Iterable filterChildResources(Iterable childResources .collect(Collectors.toList()); } }); + } + + @Test + void testGetExportedItems() throws Exception { Panel wizard = Utils.getComponentUnderTest(PATH_WIZARD, Panel.class, context); wizard.getExportedItems(); + } + @Test + void testNoFieldType() { + Panel wizard = Utils.getComponentUnderTest(PATH_WIZARD_WITHOUT_FIELDTYPE, Panel.class, context); + assertEquals(FieldType.PANEL.getValue(), wizard.getFieldType()); } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImplTest.java index 9edf57eb1c..50e14bbee9 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImplTest.java @@ -45,6 +45,7 @@ import com.adobe.cq.export.json.SlingModelFilter; import com.adobe.cq.forms.core.Utils; import com.adobe.cq.forms.core.components.internal.form.FormConstants; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.FormClientLibManager; import com.adobe.cq.forms.core.components.models.form.FormContainer; import com.adobe.cq.forms.core.components.models.form.TextInput; @@ -75,6 +76,7 @@ public class FormContainerImplTest { private static final String CONTENT_ROOT = CONTENT_PAGE_ROOT + "/jcr:content"; private static final String CONTENT_DAM_ROOT = "/content/dam/formsanddocuments/demo"; private static final String PATH_FORM_1 = CONTENT_ROOT + "/formcontainerv2"; + private static final String PATH_FORM_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/formcontainerv2-without-fieldtype"; private static final String PATH_FORM_1_WITHOUT_REDIRECT = CONTENT_ROOT + "/formcontainerv2WithoutRedirect"; private static final String CONTENT_FORM_WITHOUT_PREFILL_ROOT = "/content/forms/af/formWithoutPrefill"; private static final String PATH_FORM_WITHOUT_PREFILL = CONTENT_FORM_WITHOUT_PREFILL_ROOT + "/formcontainerv2WithoutPrefill"; @@ -161,7 +163,7 @@ void testGetAdaptiveFormCustomVersion() throws Exception { void testGetAdaptiveFormDefaultVersion() throws Exception { FormContainer formContainer = Utils.getComponentUnderTest(PATH_FORM_1, FormContainer.class, context); assertNotNull(formContainer.getAdaptiveFormVersion()); - assertEquals("0.14.0", formContainer.getAdaptiveFormVersion()); + assertEquals("0.14.1", formContainer.getAdaptiveFormVersion()); } @Test @@ -477,4 +479,9 @@ public void testGetLanguageDirection() throws Exception { assertEquals("ltr", formContainer.getLanguageDirection()); } + @Test + void testNoFieldType() { + FormContainer formContainer = Utils.getComponentUnderTest(PATH_FORM_WITHOUT_FIELDTYPE, FormContainer.class, context); + assertEquals(FieldType.FORM.getValue(), formContainer.getFieldType()); + } } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/TitleImplV2Test.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/TitleImplV2Test.java index 5858acff8f..e62908a127 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/TitleImplV2Test.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/TitleImplV2Test.java @@ -39,6 +39,7 @@ import com.adobe.cq.forms.core.Utils; import com.adobe.cq.forms.core.components.internal.form.FormConstants; import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.FormTitle; import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext; import com.adobe.cq.wcm.core.components.internal.DataLayerConfig; @@ -64,6 +65,7 @@ public class TitleImplV2Test { private static final String PATH_TITLE_NOPROPS = CONTENT_ROOT + "/title-noprops"; private static final String PATH_TITLE_WRONGTYPE = CONTENT_ROOT + "/title-wrongtype"; + private static final String PATH_TITLE_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/title-without-fieldtype"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -214,4 +216,10 @@ protected FormTitle getTitleUnderTest(String resourcePath, Object... properties) } + @Test + void testNoFieldType() { + TitleImplV2 title = Utils.getComponentUnderTest(PATH_TITLE_WITHOUT_FIELDTYPE, TitleImplV2.class, context); + assertEquals(FieldType.PLAIN_TEXT.getValue(), title.getFieldType()); + } + } diff --git a/bundles/af-core/src/test/resources/form/button/exporter-button-without-fieldtype.json b/bundles/af-core/src/test/resources/form/button/exporter-button-without-fieldtype.json new file mode 100644 index 0000000000..49a52b7957 --- /dev/null +++ b/bundles/af-core/src/test/resources/form/button/exporter-button-without-fieldtype.json @@ -0,0 +1,29 @@ +{ + "id": "button-112233", + "dataRef": "test-button-ref", + "fieldType": "button", + "name": "no-fieldType-button", + "description": "test-description", + "tooltip": "test-short-description", + "type": "string", + "buttonType": "button", + "properties": { + "afs:layout": { + "tooltipVisible": false + }, + "fd:dor": { + "dorExclusion": true + }, + "fd:path": "/content/button-without-fieldtype", + "fd:buttonType": "button" + }, + "label": { + "value": "no-fieldType-button" + }, + "events": { + "custom:setProperty": [ + "$event.payload" + ] + }, + ":type": "core/fd/components/form/button/v1/button" +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/form/button/test-content.json b/bundles/af-core/src/test/resources/form/button/test-content.json index 42f1fa2291..322cf48b65 100644 --- a/bundles/af-core/src/test/resources/form/button/test-content.json +++ b/bundles/af-core/src/test/resources/form/button/test-content.json @@ -25,5 +25,16 @@ "dataRef" : "test-button-ref", "tooltip": "test-short-description", "fieldType": "button" + }, + "button-without-fieldtype" : { + "id": "button-112233", + "jcr:primaryType": "nt:unstructured", + "dorExclusion": true, + "sling:resourceType" : "core/fd/components/form/button/v1/button", + "name" : "no-fieldType-button", + "jcr:title" : "no-fieldType-button", + "description" : "test-description", + "dataRef" : "test-button-ref", + "tooltip": "test-short-description" } } diff --git a/bundles/af-core/src/test/resources/form/checkbox/exporter-checkbox-without-fieldtype.json b/bundles/af-core/src/test/resources/form/checkbox/exporter-checkbox-without-fieldtype.json new file mode 100644 index 0000000000..3869dc480b --- /dev/null +++ b/bundles/af-core/src/test/resources/form/checkbox/exporter-checkbox-without-fieldtype.json @@ -0,0 +1,32 @@ +{ + "id": "checkbox-wo-fieldtype1", + "name": "abc", + "fieldType": "checkbox", + "description" : "dummy", + "tooltip": "test-short-description", + "properties": { + "afs:layout" : { + "tooltipVisible": false + }, + "fd:dor": { + "dorExclusion":false + }, + "fd:path":"/content/checkbox-without-fieldtype", + "customProp": "customPropValue" + }, + "enforceEnum":true, + "enum" : ["on", "off"], + "label": { + "value": "def" + }, + "dataRef":"a.b", + "screenReaderText": "'Custom screen reader text'", + "constraintMessages":{ + "type":"incorrect type" + }, + "events" : { + "custom:setProperty" : ["$event.payload"] + }, + "type": "string", + ":type": "core/fd/components/form/checkbox/v1/checkbox" +} diff --git a/bundles/af-core/src/test/resources/form/checkbox/test-content.json b/bundles/af-core/src/test/resources/form/checkbox/test-content.json index 754116ad80..778507bcac 100644 --- a/bundles/af-core/src/test/resources/form/checkbox/test-content.json +++ b/bundles/af-core/src/test/resources/form/checkbox/test-content.json @@ -93,5 +93,29 @@ "fd:events" : { "jcr:primaryType": "nt:unstructured" } + }, + "checkbox-without-fieldtype" : { + "id": "checkbox-wo-fieldtype1", + "jcr:primaryType": "nt:unstructured", + "sling:resourceType" : "core/fd/components/form/checkbox/v1/checkbox", + "name" : "abc", + "jcr:title" : "def", + "description" : "dummy", + "assistPriority" : "custom", + "customProp": "customPropValue", + "dataRef" : "a.b", + "custom" : "Custom screen reader text", + "typeMessage" : "incorrect type", + "tooltip": "test-short-description", + "type" : "string", + "checkedValue": "on", + "uncheckedValue": "off", + "enableUncheckedValue": true, + "fd:rules" : { + "jcr:primaryType": "nt:unstructured" + }, + "fd:events" : { + "jcr:primaryType": "nt:unstructured" + } } } diff --git a/bundles/af-core/src/test/resources/form/checkboxgroup/exporter-checkboxgroup-without-fieldtype.json b/bundles/af-core/src/test/resources/form/checkboxgroup/exporter-checkboxgroup-without-fieldtype.json new file mode 100644 index 0000000000..31424794c5 --- /dev/null +++ b/bundles/af-core/src/test/resources/form/checkboxgroup/exporter-checkboxgroup-without-fieldtype.json @@ -0,0 +1,33 @@ +{ + "id": "checkboxgroup-a484170b97", + "fieldType": "checkbox-group", + "name": "checkboxgroup1722332761006", + "type": "number[]", + "enforceEnum": true, + "enumNames": [ + "Item 1", + " Item 2" + ], + "label": { + "value": "Check Box Group" + }, + "properties": { + "afs:layout": { + "orientation": "horizontal" + }, + "fd:dor": { + "dorExclusion": false + }, + "fd:path": "/content/checkboxgroup-without-fieldtype" + }, + "events": { + "custom:setProperty": [ + "$event.payload" + ] + }, + "enum": [ + 0, + 1 + ], + ":type": "forms-components-examples/components/form/checkboxgroup" +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/form/checkboxgroup/test-content.json b/bundles/af-core/src/test/resources/form/checkboxgroup/test-content.json index e457f6f156..cdd7d6bc34 100644 --- a/bundles/af-core/src/test/resources/form/checkboxgroup/test-content.json +++ b/bundles/af-core/src/test/resources/form/checkboxgroup/test-content.json @@ -252,5 +252,22 @@ 20 ], ":type": "forms-components-examples/components/form/checkboxgroup" + }, + "checkboxgroup-without-fieldtype": { + "id": "checkboxgroup-a484170b97", + "jcr:primaryType": "nt:unstructured", + "jcr:title": "Check Box Group", + "enum": [ + "0", + "1" + ], + "name": "checkboxgroup1722332761006", + "type": "number[]", + "enumNames": [ + "Item 1", + " Item 2" + ], + "jcr:lastModified": "Tue Jul 30 2024 15:16:00 GMT+0530", + "sling:resourceType": "forms-components-examples/components/form/checkboxgroup" } } diff --git a/bundles/af-core/src/test/resources/form/datepicker/exporter-datepicker-without-fieldtype.json b/bundles/af-core/src/test/resources/form/datepicker/exporter-datepicker-without-fieldtype.json new file mode 100644 index 0000000000..4b6b81c48a --- /dev/null +++ b/bundles/af-core/src/test/resources/form/datepicker/exporter-datepicker-without-fieldtype.json @@ -0,0 +1,22 @@ +{ + "id": "datepicker-without-fieldtype1", + "fieldType": "date-input", + "name": "abc", + "type": "string", + "label": { + "value": "def" + }, + "events": { + "custom:setProperty": [ + "$event.payload" + ] + }, + "properties": { + "fd:dor": { + "dorExclusion": false + }, + "fd:path": "/content/datepicker-without-fieldtype" + }, + "format": "date", + ":type": "core/fd/components/form/datepicker/v1/datepicker" +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/form/datepicker/test-content.json b/bundles/af-core/src/test/resources/form/datepicker/test-content.json index 67aef568ce..1690343dc6 100644 --- a/bundles/af-core/src/test/resources/form/datepicker/test-content.json +++ b/bundles/af-core/src/test/resources/form/datepicker/test-content.json @@ -123,5 +123,12 @@ "jcr:title" : "def", "fieldType": "date-input", "displayValueExpression": "($field.$value & abc)" + }, + "datepicker-without-fieldtype" : { + "id": "datepicker-without-fieldtype1", + "jcr:primaryType": "nt:unstructured", + "sling:resourceType" : "core/fd/components/form/datepicker/v1/datepicker", + "name" : "abc", + "jcr:title" : "def" } } diff --git a/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown-without-fieldtype.json b/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown-without-fieldtype.json new file mode 100644 index 0000000000..93e51cdf4b --- /dev/null +++ b/bundles/af-core/src/test/resources/form/dropdown/exporter-dropdown-without-fieldtype.json @@ -0,0 +1,24 @@ +{ + "id": "dropdown-without-fieldtype1", + "fieldType": "drop-down", + "name": "abc", + "type": "string", + "enforceEnum": true, + "enumNames": ["m", "f", "o"], + "enum": ["0", "1", "2"], + "label": { + "value": "def" + }, + "events": { + "custom:setProperty": [ + "$event.payload" + ] + }, + "properties": { + "fd:dor": { + "dorExclusion": false + }, + "fd:path": "/content/dropdown-without-fieldtype" + }, + ":type": "core/fd/components/form/dropdown/v1/dropdown" +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/form/dropdown/test-content.json b/bundles/af-core/src/test/resources/form/dropdown/test-content.json index 89f1b880af..1e7779e1f8 100644 --- a/bundles/af-core/src/test/resources/form/dropdown/test-content.json +++ b/bundles/af-core/src/test/resources/form/dropdown/test-content.json @@ -330,5 +330,14 @@ "1" ], ":type": "forms-components-examples/components/form/dropdown" + }, + "dropdown-without-fieldtype" : { + "id": "dropdown-without-fieldtype1", + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "core/fd/components/form/dropdown/v1/dropdown", + "name" : "abc", + "jcr:title" : "def", + "enum" : [0, 1, 2], + "enumNames" : ["m", "f", "o"] } } \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/form/fileinput/exporter-fileinput-without-fieldtype.json b/bundles/af-core/src/test/resources/form/fileinput/exporter-fileinput-without-fieldtype.json new file mode 100644 index 0000000000..ea3e9d5c36 --- /dev/null +++ b/bundles/af-core/src/test/resources/form/fileinput/exporter-fileinput-without-fieldtype.json @@ -0,0 +1,29 @@ +{ + "id": "fileinput-d3a33813a1", + "fieldType": "file-input", + "name": "abc", + "label": { + "value": "def" + }, + "type": "file", + "accept": [ + "audio/*", + " video/*", + " image/*", + " text/*", + " application/pdf" + ], + "events": { + "custom:setProperty": [ + "$event.payload" + ] + }, + "properties": { + "fd:dor": { + "dorExclusion": false + }, + "fd:path": "/content/fileinput-without-fieldtype", + "fd:buttonText": "Attach" + }, + ":type": "core/fd/components/form/fileinput/v1/fileinput" +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/form/fileinput/test-content.json b/bundles/af-core/src/test/resources/form/fileinput/test-content.json index 2eef92884a..e40420b116 100644 --- a/bundles/af-core/src/test/resources/form/fileinput/test-content.json +++ b/bundles/af-core/src/test/resources/form/fileinput/test-content.json @@ -101,5 +101,17 @@ "maxItems" : 2, "maxFileSize" : "4096", "accept" : ["text/*", "application/pdf"] + }, + "fileinput-without-fieldtype": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType" : "core/fd/components/form/fileinput/v1/fileinput", + "name" : "abc", + "jcr:title" : "def", + "buttonText" : "Attach", + "accept" : ["audio/*", + " video/*", + " image/*", + " text/*", + " application/pdf"] } } diff --git a/bundles/af-core/src/test/resources/form/formcontainer/exporter-formcontainerv2.json b/bundles/af-core/src/test/resources/form/formcontainer/exporter-formcontainerv2.json index 2a9db08623..34eea64928 100644 --- a/bundles/af-core/src/test/resources/form/formcontainer/exporter-formcontainerv2.json +++ b/bundles/af-core/src/test/resources/form/formcontainer/exporter-formcontainerv2.json @@ -25,7 +25,7 @@ ":itemsOrder": [ "textinput" ], - "adaptiveform": "0.14.0", + "adaptiveform": "0.14.1", "metadata": { "version": "1.0.0", "grammar": "json-formula-1.0.0" diff --git a/bundles/af-core/src/test/resources/form/formcontainer/test-page-content.json b/bundles/af-core/src/test/resources/form/formcontainer/test-page-content.json index 1d1bd0d237..0d1052b68d 100644 --- a/bundles/af-core/src/test/resources/form/formcontainer/test-page-content.json +++ b/bundles/af-core/src/test/resources/form/formcontainer/test-page-content.json @@ -64,6 +64,24 @@ }, "action": "/a/b", "dataUrl": "/c/d" + }, + "formcontainerv2-without-fieldtype": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType" : "core/fd/components/form/container/v2/container", + "thankyouPage": "/a/b/c", + "thankyouMessage": "message", + "prefillService" : "abc", + "textinput" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType" : "core/fd/components/form/textinput/v1/textinput", + "name" : "abc", + "jcr:title" : "def", + "hideTitle" : false, + "description" : "dummy", + "fd:translationIds" : "{\"jcr:title\":\"guideContainer##textinput##jcr:title##5598\",\"placeholder\":\"guideContainer##textinput##description##5648\"}", + "visible" : false, + "customProp": "customPropValue" + } } } } \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/form/fragment/test-content.json b/bundles/af-core/src/test/resources/form/fragment/test-content.json index 131618eea5..93caa46d2c 100644 --- a/bundles/af-core/src/test/resources/form/fragment/test-content.json +++ b/bundles/af-core/src/test/resources/form/fragment/test-content.json @@ -28,6 +28,19 @@ "fieldType": "panel", "fragmentPath": "/content/dam/formsanddocuments/affragment" }, + "fragment-without-fieldtype": { + "jcr:primaryType": "nt:unstructured", + "wrapData": true, + "jcr:title": "Fragment", + "minOccur": "0", + "jcr:lastModifiedBy": "admin", + "name": "fragment-123", + "maxOccur": "4", + "jcr:lastModified": "Fri Jun 02 2023 12:34:24 GMT+0530", + "repeatable": true, + "sling:resourceType": "core/fd/components/form/fragment/v1/fragment", + "fragmentPath": "/content/affragment" + }, "affragment": { "jcr:primaryType": "nt:unstructured", "jcr:title": "AF Fragment (v2)", diff --git a/bundles/af-core/src/test/resources/form/hcaptcha/test-content.json b/bundles/af-core/src/test/resources/form/hcaptcha/test-content.json index 6896b2b7e4..3045180149 100644 --- a/bundles/af-core/src/test/resources/form/hcaptcha/test-content.json +++ b/bundles/af-core/src/test/resources/form/hcaptcha/test-content.json @@ -19,5 +19,22 @@ "textIsRich": "true", "unboundFormElement": false, "customProp": "customPropValue" + }, + "hcaptcha-without-fieldtype": { + "jcr:primaryType": "nt:unstructured", + "jcr:createdBy": "admin", + "jcr:title": "HCAPTCHA", + "enabled": true, + "jcr:lastModifiedBy": "admin", + "readOnly": false, + "required": true, + "jcr:created": "Thu Apr 11 2024 10:37:33 GMT+0530", + "name": "test-hcaptcha", + "size": "normal", + "cloudServicePath": "always-challenge", + "visible": true, + "hideTitle": "false", + "jcr:lastModified": "Thu Apr 11 2024 10:37:39 GMT+0530", + "sling:resourceType": "core/fd/components/form/hcaptcha/v1/hcaptcha" } } diff --git a/bundles/af-core/src/test/resources/form/image/test-content.json b/bundles/af-core/src/test/resources/form/image/test-content.json index 3148df9308..3e7f023ea4 100644 --- a/bundles/af-core/src/test/resources/form/image/test-content.json +++ b/bundles/af-core/src/test/resources/form/image/test-content.json @@ -55,5 +55,14 @@ "properties": { "fd:path": "/content/forms/af/af2/jcr:content/guideContainer/image" } + }, + "image-without-fieldtype" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "core/fd/components/form/image/v1/image", + "name" : "abcd", + "jcr:title" : "def", + "hideTitle" : false, + "visible" : false, + "altText": "abc" } } \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/form/numberinput/test-content.json b/bundles/af-core/src/test/resources/form/numberinput/test-content.json index f1fec9a0e7..1e5bc07491 100644 --- a/bundles/af-core/src/test/resources/form/numberinput/test-content.json +++ b/bundles/af-core/src/test/resources/form/numberinput/test-content.json @@ -187,5 +187,11 @@ }, "fd:path": "/content/forms/af/af2/jcr:content/guideContainer/accordion/item_2/numberinput" } + }, + "numberinput-without-fieldtype" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType" : "core/fd/components/form/numberinput/v1/numberinput", + "name" : "abc", + "jcr:title" : "def" } } diff --git a/bundles/af-core/src/test/resources/form/panel/test-content.json b/bundles/af-core/src/test/resources/form/panel/test-content.json index 2324777134..5708cfefd2 100644 --- a/bundles/af-core/src/test/resources/form/panel/test-content.json +++ b/bundles/af-core/src/test/resources/form/panel/test-content.json @@ -81,5 +81,23 @@ "fieldType" : "text-input", "visible" : false } + }, + "panel-without-fieldtype": { + "name" : "abc", + "jcr:primaryType": "nt:unstructured", + "sling:resourceType" : "core/fd/components/form/panel/v1/panel", + "jcr:title": "dependent names", + "description" : "dependent names description", + "tooltip" : "dependent names tooltip", + "dataRef": "$.contact_1501573930059", + "textinput" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType" : "core/fd/components/form/textinput/v1/textinput", + "name" : "abc", + "jcr:title" : "def", + "hideTitle" : false, + "description" : "dummy", + "visible" : false + } } } \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/form/radiobutton/test-content.json b/bundles/af-core/src/test/resources/form/radiobutton/test-content.json index 0c8a147bde..f4b6205a12 100644 --- a/bundles/af-core/src/test/resources/form/radiobutton/test-content.json +++ b/bundles/af-core/src/test/resources/form/radiobutton/test-content.json @@ -334,5 +334,21 @@ "true" ], "validateExpMessage": "Required Expression" + }, + "radiobutton-without-fieldtype": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "core/fd/components/form/radiobutton/v1/radiobutton", + "name": "radiobutton_12345", + "jcr:title": "Radio Button", + "orientation": "vertical", + "enum": [ + "0", + "1" + ], + "enumNames": [ + "

Item 1

", + "

Item 2

" + ], + "fieldType": "radio-group" } } \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/form/recaptcha/test-content.json b/bundles/af-core/src/test/resources/form/recaptcha/test-content.json index af32db5a8f..21301007c1 100644 --- a/bundles/af-core/src/test/resources/form/recaptcha/test-content.json +++ b/bundles/af-core/src/test/resources/form/recaptcha/test-content.json @@ -23,5 +23,29 @@ "properties": { "fd:path": "/content/forms/af/af2runtime/jcr:content/guideContainer/recaptcha" } + }, + "recaptcha-without-fieldtype": { + "id": "recaptcha-4b672680a2", + "jcr:primaryType": "nt:unstructured", + "jcr:createdBy": "admin", + "jcr:title": "CAPTCHA", + "enabled": true, + "readOnly": false, + "mandatory": "true", + "name": "test-recaptcha", + "rcCloudServicePath": "v2checkbox", + "visible": true, + "hideTitle": "false", + "sling:resourceType": "core/fd/components/form/recaptcha/v1/recaptcha", + "recaptchaSize": "compact", + "customProp": "customPropValue", + "events": { + "custom:setProperty": [ + "$event.payload" + ] + }, + "properties": { + "fd:path": "/content/forms/af/af2runtime/jcr:content/guideContainer/recaptcha" + } } } \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/form/switch/test-content.json b/bundles/af-core/src/test/resources/form/switch/test-content.json index 96d0227be1..d62334d044 100644 --- a/bundles/af-core/src/test/resources/form/switch/test-content.json +++ b/bundles/af-core/src/test/resources/form/switch/test-content.json @@ -173,5 +173,30 @@ "fd:events" : { "jcr:primaryType": "nt:unstructured" } + }, + "switch-without-fieldtype" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType" : "core/fd/components/form/switch/v1/switch", + "name" : "abc", + "jcr:title" : "def", + "description" : "dummy", + "tooltip": "test-short-description", + "type" : "string", + "enum": [ + "0", + "1" + ], + "enumNames": [ + "OFF", + "ON" + ], + "enableUncheckedValue": true, + "fd:rules" : { + "jcr:primaryType": "nt:unstructured" + }, + "fd:events" : { + "jcr:primaryType": "nt:unstructured" + }, + "customProp": "customPropValue" } } diff --git a/bundles/af-core/src/test/resources/form/termsandconditions/test-content.json b/bundles/af-core/src/test/resources/form/termsandconditions/test-content.json index ac053e9de2..3394a3594b 100644 --- a/bundles/af-core/src/test/resources/form/termsandconditions/test-content.json +++ b/bundles/af-core/src/test/resources/form/termsandconditions/test-content.json @@ -86,5 +86,48 @@ "sling:resourceType": "core/fd/components/form/checkboxgroup/v1/checkboxgroup", "fieldType": "checkbox-group" } + }, + "termsandconditions-without-fieldtype": { + "showApprovalOption": true, + "jcr:title": "Terms And Conditions", + "fd:tnc": true, + "showAsPopup": true, + "name": "termsandconditions1694159302516", + "sling:resourceType": "core/fd/components/form/termsandconditions/v1/termsandconditions", + "wrapData": true, + "customProp": "customPropValue", + "text": { + "jcr:primaryType": "nt:unstructured", + "jcr:title": "", + "name": "consenttext", + "value": "Text related to the terms and conditions come here", + "hideTitle": "true", + "sling:resourceType": "core/fd/components/form/text/v1/text", + "fieldType": "plain-text" + }, + "approvalcheckbox": { + "jcr:primaryType": "nt:unstructured", + "jcr:title": "I agree to the terms & conditions", + "enabled": "false", + "name": "approvalcheckbox", + "checkedValue": "true", + "sling:resourceType": "core/fd/components/form/checkbox/v1/checkbox", + "fieldType": "checkbox" + }, + "link": { + "jcr:primaryType": "nt:unstructured", + "jcr:title": "", + "orientation": "vertical", + "enum": [ + "yourlink" + ], + "name": "link1694159323342", + "title": "I agree to the terms & conditions", + "enumNames": [ + "label for the link" + ], + "sling:resourceType": "core/fd/components/form/checkboxgroup/v1/checkboxgroup", + "fieldType": "checkbox-group" + } } } diff --git a/bundles/af-core/src/test/resources/form/text/test-content.json b/bundles/af-core/src/test/resources/form/text/test-content.json index a75b315f2c..196efd53d4 100644 --- a/bundles/af-core/src/test/resources/form/text/test-content.json +++ b/bundles/af-core/src/test/resources/form/text/test-content.json @@ -36,5 +36,10 @@ "dorExclusion": true } } + }, + "text-without-fieldtype" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "core/fd/components/form/text/v1/text", + "name" : "abc" } } \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/form/textinput/test-content.json b/bundles/af-core/src/test/resources/form/textinput/test-content.json index 9da3b0c20f..23577ab36a 100644 --- a/bundles/af-core/src/test/resources/form/textinput/test-content.json +++ b/bundles/af-core/src/test/resources/form/textinput/test-content.json @@ -194,5 +194,13 @@ "fieldType": "text-input", "placeholder": "test-placeholder", "fd:viewType": "some/custom/value" + }, + "textinput-without-fieldtype" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType" : "core/fd/components/form/textinput/v1/textinput", + "name" : "abc", + "jcr:title" : "def", + "placeholder": "test-placeholder", + "fd:viewType": "some/custom/value" } } diff --git a/bundles/af-core/src/test/resources/form/titleV2/test-content.json b/bundles/af-core/src/test/resources/form/titleV2/test-content.json index fb07cace8e..4adccc64ae 100644 --- a/bundles/af-core/src/test/resources/form/titleV2/test-content.json +++ b/bundles/af-core/src/test/resources/form/titleV2/test-content.json @@ -23,5 +23,11 @@ "fd:htmlelementType": "h2", "fieldType": "plain-text", "sling:resourceType": "core/fd/components/form/title/v2/title" + }, + "title-without-fieldtype" : { + "jcr:primaryType": "nt:unstructured", + "jcr:title": "Title", + "id": "abc", + "sling:resourceType": "core/fd/components/form/title/v1/title" } } diff --git a/bundles/af-core/src/test/resources/form/wizard/test-content.json b/bundles/af-core/src/test/resources/form/wizard/test-content.json index 42922a45dc..912303e4e4 100644 --- a/bundles/af-core/src/test/resources/form/wizard/test-content.json +++ b/bundles/af-core/src/test/resources/form/wizard/test-content.json @@ -30,5 +30,36 @@ "fd:events": { "jcr:primaryType": "nt:unstructured" } + }, + "wizard-without-fieldtype": { + "jcr:primaryType": "nt:unstructured", + "jcr:createdBy": "admin", + "jcr:title": "wizard", + "jcr:lastModifiedBy": "admin", + "jcr:created": "Mon Nov 14 2022 16:09:34 GMT+0530", + "name": "wizard1668422374531", + "jcr:lastModified": "Mon Nov 14 2022 16:09:34 GMT+0530", + "sling:resourceType": "forms-components-examples/components/form/wizard", + "numberinput": { + "jcr:primaryType": "nt:unstructured", + "jcr:createdBy": "admin", + "jcr:title": "Number Input", + "jcr:lastModifiedBy": "admin", + "jcr:created": "Mon Nov 14 2022 16:09:39 GMT+0530", + "name": "numberinput1668422379604", + "jcr:lastModified": "Mon Nov 14 2022 16:09:39 GMT+0530", + "sling:resourceType": "forms-components-examples/components/form/numberinput", + "fieldType": "number-input" + }, + "fd:rules": { + "jcr:primaryType": "nt:unstructured", + "fd:visible": [ + "{\"nodeName\":\"ROOT\",\"items\":[{\"nodeName\":\"STATEMENT\",\"choice\":{\"nodeName\":\"VISIBLE_EXPRESSION\",\"items\":[{\"nodeName\":\"AFCOMPONENT\",\"value\":{\"id\":\"$form.wizard1668422374531\",\"type\":\"AFCOMPONENT\",\"name\":\"wizard1668422374531\"}},{\"nodeName\":\"When\",\"value\":null},{\"nodeName\":\"CONDITIONORALWAYS\",\"choice\":null},{\"nodeName\":\"Else\",\"value\":null},{\"nodeName\":\"DONOTHING_OR_SHOW\",\"choice\":{\"nodeName\":\"Show\",\"value\":null}}]}}],\"isValid\":true,\"enabled\":true,\"version\":1,\"script\":\"false()\",\"eventName\":\"Visibility\",\"ruleType\":\"\",\"description\":\"\"}" + ], + "visible": "false()" + }, + "fd:events": { + "jcr:primaryType": "nt:unstructured" + } } } \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.0/adaptive-form.schema.json b/bundles/af-core/src/test/resources/schema/0.14.0/adaptive-form.schema.json index 120430c28c..e371c53ee9 100644 --- a/bundles/af-core/src/test/resources/schema/0.14.0/adaptive-form.schema.json +++ b/bundles/af-core/src/test/resources/schema/0.14.0/adaptive-form.schema.json @@ -811,7 +811,9 @@ "rules", "screenReaderText", "tooltip", - "visible" + "visible", + "type", + "buttonType" ], "errorMessage": { "enum": "${0} property is not allowed in Button" diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-aem-allowed-components.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-aem-allowed-components.schema.json new file mode 100644 index 0000000000..38499fcf1e --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-aem-allowed-components.schema.json @@ -0,0 +1,18 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form-aem-allowed-components.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "title": "Allowed Components object for the current panel.", + "description": "This is applicable only if the panel's layout is grid system. This property is useful if needs to show list of allowed components in the client while authoring the panel.", + "properties": { + "components": { + "type": "array", + "title": "List of simple objects representing all Allowed Components for the given panel" + }, + "applicable": { + "type": "boolean", + "title": "Is the given panel contained by a page, with authored template structure and is the given panel set as editable (unlocked)", + "description": "true if the template has structure support and the panel is editable, false otherwise" + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-aem-responsive-grid-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-aem-responsive-grid-properties.schema.json new file mode 100644 index 0000000000..8d935febca --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-aem-responsive-grid-properties.schema.json @@ -0,0 +1,52 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form-aem-responsive-grid-properties.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "allowedComponents": { + "$ref": "./adaptive-form-aem-allowed-components.schema.json" + }, + "appliedCssClassNames": { + "title": "CSS classes delimited using a SPACE character", + "description": "Describes the style system information associated with the current form element", + "type": "string", + "examples": [ + { + "appliedCssClassNames": "outlined red-border" + } + ] + }, + "gridClassNames": { + "title": "The CSS class names to be applied to the current panel delimited using a SPACE character", + "description": "This is applicable only if the panel's layout is grid system.", + "type": "string", + "examples": [ + { + "gridClassNames": "aem-Grid aem-Grid--12 aem-Grid--default--12" + } + ] + }, + "columnClassNames": { + "title": "The CSS class names associated with each responsive grid column and listed by column name", + "description": "This is applicable only if the panel's layout is grid system.", + "type": "object", + "examples": [ + { + "columnClassNames": { + "title_v3": "aem-GridColumn aem-GridColumn--default--12" + } + } + ] + }, + "columnCount": { + "title": "The number of columns available for direct children in the panel.", + "description": "This is applicable only if the panel's layout is grid system.", + "type": "number", + "examples": [ + { + "columnCount": 12 + } + ] + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-container-dor-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-container-dor-properties.schema.json new file mode 100644 index 0000000000..e5c9aae453 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-container-dor-properties.schema.json @@ -0,0 +1,41 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form-container-dor-properties.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "properties": { + "dorType": { + "title": "DOR Type", + "description": "Describes the type of Document of Record (DOR)", + "type": "string", + "enum": [ + "generate", + "select" + ], + "examples": [ + { + "dorType": "generate" + } + ] + }, + "dorTemplateRef": { + "title": "DOR Template Reference", + "description": "Reference to the template for the Document of Record (DOR).", + "type": "string", + "examples": [ + { + "dorTemplateRef": "/content/dam/formsanddocuments/acro form conversion.pdf" + } + ] + }, + "dorTemplateType": { + "title": "DOR Template Type", + "description": "Type of the template for the Document of Record (DOR).", + "enum": [ + "acroform", + "xfa" + ], + "type": "string" + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-data-constraints.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-data-constraints.schema.json new file mode 100644 index 0000000000..2ed18d6729 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-data-constraints.schema.json @@ -0,0 +1,143 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form-data-constraints.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Constraints applicable to fields", + "type": "object", + "properties": { + "accept": { + "title": "The constraint is applicable for fields having type file or with fields having type string and format as data-url / binary. It signifies the list of IANA media types that fields can accept.", + "type": "array", + "items": { + "type": "string" + } + }, + "enforceEnum": { + "title": "Whether a user can enter a value that is not present in the enum array", + "description": "If set to true, a user will be able to enter any other value that is not in the list of enum. That generally means that enum is used a aid for users to enter the value but is not a validation constraint.", + "type": "boolean" + }, + "exclusiveMaximum": { + "title": "maximum value or date (exclusive)", + "oneOf": [ + { + "type": "string", + "format": "date" + }, + { + "type": "number" + } + ] + }, + "exclusiveMinimum": { + "title": "minimum value or date (exclusive)", + "oneOf": [ + { + "type": "string", + "format": "date" + }, + { + "type": "number" + } + ] + }, + "format": { + "title": "formats as specified in JSON Schema. The constraint is applicable only for string data types", + "type": "string", + "enum": [ + "date", + "email", + "date-time", + "data-url" + ] + }, + "maxFileSize": { + "title": "The constraint is applicable for fields having type file or with fields having type string and format as data-url / binary. It signifies the maximum file size as per IEC specification", + "type": "string" + }, + "maximum": { + "title": "maximum value or date (inclusive)", + "oneOf": [ + { + "type": "string", + "format": "date" + }, + { + "type": "number" + } + ] + }, + "maxItems": { + "title": "Maximum number of items in a field/panel capturing array data", + "type": "number" + }, + "maxOccur": { + "title": "Maximum number of occurrence of repeating panel - capturing array data,", + "type": "number" + }, + "maxLength": { + "title": "Maximum Length of the data. The constraint is applicable only for string data types", + "type": "number" + }, + "minimum": { + "title": "minimum value or date (inclusive)", + "oneOf": [ + { + "type": "string", + "format": "date" + }, + { + "type": "number" + } + ] + }, + "minItems": { + "title": "Minimum number of items in a field/panel capturing array data", + "type": "number" + }, + "minOccur": { + "title": "Minimum number of occurrence of repeating panel - capturing array data", + "type": "number" + }, + "minLength": { + "title": "Minimum Length of the data. The constraint is applicable only for string data types", + "type": "number" + }, + "pattern": { + "title": "The regular expression against which the value will be compared against", + "type": "string", + "format": "regex" + }, + "required": { + "type": "boolean", + "title": "Indicates whether the value is required or not" + }, + "step": { + "title": "The constraint is applicable for fields having type number. It signifies the value should be a multipleOf some number", + "type": "number" + }, + "type": { + "title": "Data Type of the value that this field captures. When submitting the value will be coerced into the format specified by the type", + "type": "string", + "enum": [ + "string", + "file", + "number", + "array", + "object", + "string[]", + "file[]", + "number[]", + "boolean[]", + "boolean" + ] + }, + "uniqueItems": { + "title": "Array items must be unique", + "type": "boolean" + }, + "validationExpression": { + "type": "string", + "format": "json-formula" + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-data-layer.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-data-layer.schema.json new file mode 100644 index 0000000000..ba972b2345 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-data-layer.schema.json @@ -0,0 +1,60 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form-data-layer.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "@id": { + "type": "string", + "title": "Id of the form element" + }, + "@type": { + "type": "string", + "title": "Type of the form element used in the data layer" + }, + "repo:modifyDate": { + "type": "string", + "title": "Last modified date using ISO 8601 standard" + }, + "parentId": { + "type": "string", + "title": "Parent id of the form element" + }, + "dc:title": { + "type": "string", + "title": "Label of the form element used in the data layer" + }, + "dc:description": { + "type": "string", + "title": "Description of the form element used in the data layer" + }, + "xdm:text": { + "type": "string", + "title": "Text of the form element used in the data layer" + }, + "xdm:linkURL": { + "type": "string", + "title": "Link URL of the form element used in the data layer" + }, + "fieldType": { + "title": "Type of widget to show to the user for capturing the data", + "enum": [ + "text-input", + "number-input", + "date-input", + "file-input", + "multiline-input", + "drop-down", + "radio-group", + "checkbox-group", + "checkbox", + "switch", + "plain-text", + "button", + "panel", + "image", + "email", + "captcha" + ] + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-defaults.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-defaults.schema.json new file mode 100644 index 0000000000..40f55cc38b --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-defaults.schema.json @@ -0,0 +1,255 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form-defaults.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "The schema defines the default field types for Form Fields", + "allOf": [ + { + "title": "Default field for capturing date types is date-input", + "if": { + "type": "object", + "properties": { + "type": { + "const": "string" + }, + "format": { + "const": "date" + } + }, + "required": [ + "type", + "format" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "date-input" + } + } + } + }, + { + "title": "Default field for capturing file types is file-input", + "if": { + "type": "object", + "properties": { + "type": { + "enum": [ + "file", + "file[]" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "file-input" + } + } + } + }, + { + "title": "Default field for capturing file types is file-input", + "if": { + "type": "object", + "properties": { + "type": { + "const": "string" + }, + "format": { + "enum": [ + "binary", + "data-url" + ] + } + }, + "required": [ + "type", + "format" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "file-input" + } + } + } + }, + { + "title": "Default field for capturing string type is text-input", + "if": { + "type": "object", + "properties": { + "type": { + "const": "string" + } + }, + "required": [ + "type" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "text-input" + } + } + } + }, + { + "title": "Default Field for capturing number types is number-input", + "if": { + "type": "object", + "properties": { + "type": { + "const": "number" + } + }, + "required": [ + "type" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "number-input" + } + } + } + }, + { + "title": "Default field for capturing data that can be only be one of two values is checkbox", + "if": { + "type": "object", + "properties": { + "enum": { + "type": "array", + "maxItems": 2 + } + }, + "required": [ + "enum" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "checkbox" + } + } + } + }, + { + "title": "Default field for capturing boolean data is checkbox", + "if": { + "type": "object", + "properties": { + "type": { + "const": "boolean" + } + }, + "required": [ + "type" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "checkbox" + }, + "enum": { + "default": [ + true, + false + ] + } + } + } + }, + { + "title": "Default field for capturing data that allows only a set of options is drop-down", + "if": { + "type": "object", + "properties": { + "enum": { + "type": "array", + "minItems": 3 + } + }, + "required": [ + "enum" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "drop-down" + } + } + } + }, + { + "title": "Default field for capturing complex types is panel", + "if": { + "type": "object", + "properties": { + "items": { + "type": [ + "array", + "object" + ] + } + }, + "required": [ + "items" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "default": "panel" + } + } + } + }, + { + "title": "Default value of dataRef for static text is none", + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "button", + "plain-text" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "dataRef": { + "default": "none" + } + } + } + } + ] +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-dor-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-dor-properties.schema.json new file mode 100644 index 0000000000..8421079d2b --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-dor-properties.schema.json @@ -0,0 +1,58 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form-dor-properties.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "properties": { + "dorColspan": { + "title": "DOR Colspan", + "description": "Specifies the colspan attribute for the Document of Record (DOR). This attribute controls the number of columns a form element should span.", + "type": "string" + }, + "breakAfterText": { + "title": "Break After Text", + "description": "Indicates whether a break should occur after the text content of the Document of Record (DOR). This affects the layout and presentation of the DOR.", + "type": "string" + }, + "breakBeforeText": { + "title": "Break Before Text", + "description": "Indicates whether a break should occur before the text content of the Document of Record (DOR). This influences the layout and presentation of the DOR.", + "type": "string" + }, + "overflowText": { + "title": "Overflow Text", + "description": "Specifies how overflow should be handled for the text content of the Document of Record (DOR). This property controls how text exceeding the available space is displayed.", + "type": "string" + }, + "dorLayoutType": { + "title": "DOR Layout Type", + "description": "Defines the layout type for the Document of Record (DOR). This property determines how the DOR elements are arranged and presented.", + "type": "string" + }, + "dorNumCols": { + "title": "DOR Number of Columns", + "description": "Specifies the number of columns for the layout of the Document of Record (DOR). This property determines how the DOR elements are arranged and presented in columns.", + "type": "string" + }, + "dorBindRef": { + "title": "DOR Binding Reference", + "description": "Specifies the binding reference for the Document of Record (DOR). This property determines how the DOR elements are bound to data.", + "type": "string" + }, + "dorExclusion": { + "title": "DOR Exclusion.", + "description": "Exclusion flag for the Document of Record (DOR).", + "type": "boolean" + }, + "dorExcludeTitle": { + "title": "Exclude Title in DOR.", + "description": "Flag to exclude title in the Document of Record (DOR).", + "type": "boolean" + }, + "dorExcludeDescription": { + "title": "Exclude Description in DOR.", + "description": "Flag to exclude description in the Document of Record (DOR).", + "type": "boolean" + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-events.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-events.schema.json new file mode 100644 index 0000000000..54a8867130 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-events.schema.json @@ -0,0 +1,79 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form-events.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Specify what operations to perform on certain user or custom events.", + "description": "Events is a dictionary of eventName to the actions to perform. Whenever the event is dispatched the expressions defined on that event are evaluated. The return value of that expression is applied to the field. The return value of the expression can be either of\n * null, literal or array: The value property of the field is set to the return value\n * dictionary: The field json is merged with the returned dictionary\n * empty dictionary: the field should not be modified.", + "$defs": { + "SingleEventHandler": { + "type": "string", + "format": "json-formula" + }, + "EventHandler": { + "oneOf": [ + { + "$ref": "#/$defs/SingleEventHandler" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/SingleEventHandler" + } + } + ] + } + }, + "type": "object", + "properties": { + "click": { + "$ref": "#/$defs/EventHandler" + }, + "initialize": { + "$ref": "#/$defs/EventHandler" + }, + "focus": { + "$ref": "#/$defs/EventHandler" + }, + "blur": { + "$ref": "#/$defs/EventHandler" + }, + "change": { + "$ref": "#/$defs/EventHandler" + }, + "submit": { + "$ref": "#/$defs/EventHandler" + } + }, + "propertyNames": { + "anyOf": [ + { + "enum": [ + "click", + "initialize", + "focus", + "blur", + "change", + "submit", + "submitError", + "submitFailure", + "submitSuccess" + ] + }, + { + "pattern": "custom:[a-zA-Z0-9]+" + } + ], + "errorMessage": "${0} is not a valid Event Name. It should be either click, initialize, focus, blur, change, submitError, submitFailure, submitSuccess or a custom event" + }, + "examples": [ + { + "Terms&Conditions": [ + { + "name": "terms" + }, + { + "click": "{value: true}" + } + ] + } + ] +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-label.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-label.schema.json new file mode 100644 index 0000000000..35fcaca0df --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-label.schema.json @@ -0,0 +1,24 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form-label.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "richText": { + "type": "boolean", + "default": false, + "title": "If the value of the label is to be considered as rich text or plain text" + }, + "visible": { + "type": "boolean", + "title": "If the field's visible property is false, this property is ignored.", + "default": true + }, + "value": { + "type": "string", + "title": "The content of the label. If the rich text property is set to true, the contents will be considered as Rich Text" + } + }, + "required": [ + "value" + ] +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-properties.schema.json new file mode 100644 index 0000000000..a0859d495f --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-properties.schema.json @@ -0,0 +1,323 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form-properties.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "$defs": { + "SingleEventHandler": { + "type": "string", + "format": "json-formula" + }, + "EventHandler": { + "oneOf": [ + { + "$ref": "#/$defs/SingleEventHandler" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/SingleEventHandler" + } + } + ] + } + }, + "allOf": [ + { + "$ref": "./adaptive-form-aem-responsive-grid-properties.schema.json" + }, + { + "type": "object", + "properties": { + ":type": { + "type": "string", + "title": "A hint to the rendering engine for rendering custom components." + }, + "altText": { + "title": "For images an alternate string to be displayed in case image cannot be shown", + "type": "string" + }, + "autocomplete": { + "title": "Provide assistance to the end users to autocomplete values saved during previous form filling sessions", + "type": "string" + }, + "checked": { + "title": "Indicates the checked status of the checkbox. The property is available only for fieldType checkbox If the value of this property is true, then the checkbox is selected and its value is set to on value. This value overrides the default property in case of a conflict.", + "type": "boolean" + }, + "constraintMessages": { + "title": "An object containing the custom error messages to be shown to the end user on different constraint validation", + "type": "object", + "propertyNames": { + "enum": [ + "type", + "required", + "minimum", + "maximum", + "minLength", + "maxLength", + "step", + "format", + "pattern", + "minItems", + "maxItems", + "maxOccur", + "minOccur", + "maxFileSize", + "accept", + "uniqueItems", + "enforceEnum", + "validationExpression" + ], + "errorMessage": "${0} is not a valid constraintMessage" + } + }, + "dataFormat": { + "type": "string", + "title": "The format in which the value will be exported or submitted. Applicable for date and number types." + }, + "dataRef": { + "type": [ + "string", + "null" + ], + "title": "The jsonpath of the data instance that is mapped to the field's value.", + "description": "It will be defined relative to the parent's dataRef property except for the two conditions. * null signifying don't save the data of this field or panel. * jsonpath begining with \"$.\" signifying that the jsonpath is not relative to the parent's dataRef property.\nIf the parent's dataRef is set to \"none\", then it will be relative to the" + }, + "default": { + "title": "The value of the field when no value is provided by the end user or data model.", + "description": "The type of this property should match the value of the `type` property defined in the Field. If not, then a type coercion will be tried and if that fails, the value will be set to null.", + "oneOf": [ + { + "type": [ + "string", + "number", + "boolean" + ] + }, + { + "type": "array", + "items": { + "type": [ + "string", + "number", + "boolean" + ] + } + } + ] + }, + "description": { + "type": "string", + "title": "Extra description to be shown to the user to aid in form filling experience. It can be rich text. Can be used as help text for a field or a top level description for a Panel" + }, + "displayFormat": { + "type": "string", + "title": "The format in which the value will be displayed to the user on screen in the field.", + "description": "The format in which the value will be displayed to the user on screen in the field. Applicable for date and number types. For example when using a currency field, the currency sign should be shown to the user." + }, + "editFormat": { + "type": "string", + "title": "The format in which the value will be edited by the user.", + "description": "The format in which the value will be edited by the user. Applicable for date and number types. For instance users in Germany would want to interchange decimal (.) and comma (,) when entering numerical values." + }, + "displayValueExpression": { + "type": "string", + "title": "The json-formula expression which when evaluated will return the value that will be displayed to the user on screen in the field.", + "description": "The json-formula expression which when evaluated will return the value that will be displayed to the user on screen in the field. Applicable for date,number, text, email and telephone input fields. For instance users might need to mask certain chars in the input." + }, + "emptyValue": { + "type": [ + "string" + ], + "title": "The value when user has not entered any value in the field", + "description": "Determines what value should be saved when user has not entered any value in the field. Can be one of\n * null\n * undefined\n * \"\" (empty string) (only valid for dataType = string)", + "enum": [ + "null", + "undefined", + "" + ] + }, + "enabled": { + "type": "boolean", + "title": "whether the field is enabled and takes part in rules, events etc. A disabled field can have calculations and custom events" + }, + "enum": { + "title": "A list of options to put restrictions on the possible values of the field", + "description": "The type of values in the enum array must match the value of the `type` property defined in the field. For array type fields, the type of element in the In case the `type` property is not defined, then the type of elements in the enum becomes the value of the `type` property. If the value of the `type` property doesn't match with the type of values in the `enum` array, then a type coercion will be made to match the `type` property. If the coercion is not possible, then the value will be set to null", + "type": "array", + "items": { + "type": [ + "string", + "boolean", + "number" + ] + }, + "uniqueItems": true + }, + "enumNames": { + "title": "A user friendly text to display for the possible options to be shown to the end user.", + "description": "The length of enum and enumNames array must match. In case the length of enum is greator, then those will be used as display text for the user. If the length of enumNames is greator, those will be discarded. enumNames will be an array of rich text strings.", + "type": "array", + "items": { + "type": "string" + } + }, + "events": { + "$ref": "./adaptive-form-events.schema.json" + }, + "fieldType": { + "title": "Type of widget to show to the user for capturing the data", + "description": "It must be one of the types from the list * text-input * number-input * date-input * file-input * drop-down * radio-group * plain-text * checkbox * button * plain-text * panel * multiline-input * panel * image * email * captcha", + "enum": [ + "text-input", + "number-input", + "date-input", + "file-input", + "multiline-input", + "drop-down", + "radio-group", + "checkbox-group", + "checkbox", + "switch", + "plain-text", + "button", + "panel", + "image", + "email", + "captcha" + ] + }, + "label": { + "$ref": "./adaptive-form-label.schema.json" + }, + "lang": { + "type": "string", + "title": "The language to use for formatting the field.", + "description": "The language needs to be defined as per the [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) tag" + }, + "dataLayer": { + "$ref": "./adaptive-form-data-layer.schema.json" + }, + "name": { + "type": "string", + "title": "Name of the element. It is also the key in the JSON data, if dataRef is not defined explicitly, that the form produces. If two fields/panels under a same panel have the same name, their values will be same" + }, + "placeholder": { + "type": "string", + "title": "The placeholder to show on the widget." + }, + "properties": { + "title": "An object containing custom properties that can be modified via rules as well.", + "type": "object", + "properties": { + "fd:dor": { + "$ref": "./adaptive-form-dor-properties.schema.json" + } + }, + "additionalProperties": true + }, + "readOnly": { + "type": "boolean", + "title": "whether the field should be readOnly to author or not", + "description": "Determines how an element is treated: 'readOnly=true' means it cannot be modified by user. It will participate in all the events." + }, + "richText": { + "type": "boolean", + "description": "whether the content of the text to be treated as rich text or not" + }, + "rules": { + "type": "object", + "title": "Rules that modify the property of the object dynamically", + "description": "An author can dynamically change any property that is defined in the spec as modifiable. The rules are evaluated whenever the dependency changes. Apart from properties defined on the field, rules can have an extra key `value` which auto computes the value of the field", + "additionalProperties": { + "type": "string" + }, + "propertyNames": { + "not": { + "enum": [ + "name", + "default", + "type", + "fieldType", + "items", + "displayFormat", + "editFormat", + "rules", + "events", + "props" + ] + } + }, + "examples": [ + { + "rules": { + "required": "$form.maritalStatus.value == 'married'" + } + }, + { + "lastName": { + "name": "lastName", + "rules": { + "value": "$form.firstName.value & ' ' & $form.lastName.value" + } + } + } + ] + }, + "screenReaderText": { + "type": "string", + "title": "a string to indicate the text to be read by screen readers" + }, + "tooltip": { + "type": "string", + "title": "Tooltip of the form element" + }, + "visible": { + "type": "boolean", + "title": "whether the field should be visible to author or not" + }, + "id": { + "type": "string", + "title": "unique identifier for a form element" + }, + "items": { + "title": "Fields/Panels inside a Panel", + "description": "If the Fields inside a panel are repeatable then the items should be an array containing only 1 field", + "type": "array", + "errorMessage": { + "oneOf": "Items must be an array with atleast 1 field" + } + }, + "repeatable": { + "type": "boolean", + "title": "whether the field/panel should be repeatable or not", + "description": "If the property is present on a field, then the data would be generated as an array depending upon the type property on the field and if the property is present on a panel then the data would be an array of object/array depending upon the value of the type property. If the type is object, then items must have a name property. If type is array, then name property in the items would be ignored." + }, + ":items": { + "title": "Fields/Panels inside a Panel", + "description": "If the Fields inside a panel are repeatable then the items should be an array containing only 1 field", + "type": "object", + "errorMessage": { + "oneOf": "Items must be an object with atleast 1 field" + } + }, + ":itemsOrder": { + "title": "Order of Fields/Panels inside a Panel", + "description": "Order of items in the object specified by :items", + "type": "array", + "errorMessage": { + "oneOf": "Items Order must be an array with atleast 1 field" + }, + "examples": [ + { + ":itemsOrder": [ + "firstName", + "lastName" + ] + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-property-restrictions.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-property-restrictions.schema.json new file mode 100644 index 0000000000..2a5ecda718 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-property-restrictions.schema.json @@ -0,0 +1,396 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form-property-restrictions.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "$defs": { + "Date": { + "title": "property with type date", + "type": "string", + "format": "date" + }, + "DateField": { + "type": "object", + "properties": { + "type": { + "enum": [ + "string", + "string[]" + ] + }, + "format": { + "const": "date" + } + }, + "required": [ + "type", + "format" + ] + }, + "NumberField": { + "type": "object", + "properties": { + "type": { + "enum": [ + "number", + "number[]" + ] + } + }, + "required": [ + "type" + ] + }, + "DateOrNumberField": { + "type": "object", + "oneOf": [ + { + "$ref": "#/$defs/NumberField" + }, + { + "$ref": "#/$defs/DateField" + } + ] + }, + "StringTypeField": { + "title": "field having type string", + "type": "object", + "properties": { + "type": { + "enum": [ + "string", + "string[]" + ] + } + } + }, + "FileTypeField": { + "title": "field with type file having format as data-url or binary", + "type": "object", + "properties": { + "type": { + "enum": [ + "string", + "string[]" + ] + }, + "format": { + "enum": [ + "binary", + "data-url" + ] + } + } + }, + "OptimizedFileTypeField": { + "title": "field having type file", + "type": "object", + "properties": { + "type": { + "enum": [ + "file", + "file[]" + ] + } + } + } + }, + "title": "The schema defines constraints on which Headless Adaptive Form properties can be used together", + "allOf": [ + { + "title": "minimum constraint is valid only for numeric or date types", + "type": "object", + "dependencies": { + "minimum": { + "oneOf": [ + { + "allOf": [ + { + "type": "object", + "properties": { + "minimum": { + "type": "number" + } + } + }, + { + "$ref": "#/$defs/NumberField" + } + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "minimum": { + "$ref": "#/$defs/Date" + } + } + }, + { + "$ref": "#/$defs/DateField" + } + ] + } + ] + } + }, + "errorMessage": "minimum constraint is valid only for numeric or date types" + }, + { + "title": "exclusiveMinimum constraint is valid only for numeric or date types", + "type": "object", + "dependencies": { + "exclusiveMinimum": { + "oneOf": [ + { + "allOf": [ + { + "type": "object", + "properties": { + "exclusiveMinimum": { + "type": "number" + } + } + }, + { + "$ref": "#/$defs/NumberField" + } + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "exclusiveMinimum": { + "$ref": "#/$defs/Date" + } + } + }, + { + "$ref": "#/$defs/DateField" + } + ] + } + ] + } + }, + "errorMessage": "exclusiveMinimum constraint is valid only for numeric or date types" + }, + { + "title": "maximum constraint is valid only for numeric or date types", + "type": "object", + "dependencies": { + "maximum": { + "oneOf": [ + { + "allOf": [ + { + "type": "object", + "properties": { + "maximum": { + "type": "number" + } + } + }, + { + "$ref": "#/$defs/NumberField" + } + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "maximum": { + "$ref": "#/$defs/Date" + } + } + }, + { + "$ref": "#/$defs/DateField" + } + ] + } + ] + } + }, + "errorMessage": "maximum constraint is valid only for numeric or date types" + }, + { + "title": "exclusiveMaximum constraint is valid only for numeric or date types", + "type": "object", + "dependencies": { + "exclusiveMinimum": { + "oneOf": [ + { + "allOf": [ + { + "type": "object", + "properties": { + "exclusiveMinimum": { + "type": "number" + } + } + }, + { + "$ref": "#/$defs/NumberField" + } + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "exclusiveMinimum": { + "$ref": "#/$defs/Date" + } + } + }, + { + "$ref": "#/$defs/DateField" + } + ] + } + ] + } + }, + "errorMessage": "exclusiveMaximum constraint is valid only for numeric or date types" + }, + { + "title": "step constraint is valid only for number type or date types", + "type": "object", + "dependencies": { + "step": { + "$ref": "#/$defs/DateOrNumberField" + } + }, + "errorMessage": "step constraint is valid only for date and number type" + }, + { + "title": "format, pattern, minLength and maxLength constraint are valid only for fields with type string", + "type": "object", + "dependencies": { + "format": { + "$ref": "#/$defs/StringTypeField" + }, + "pattern": { + "$ref": "#/$defs/StringTypeField" + }, + "minLength": { + "$ref": "#/$defs/StringTypeField" + }, + "maxLength": { + "$ref": "#/$defs/StringTypeField" + } + }, + "errorMessage": "format, pattern, minLength and maxLength constraint are valid only for fields with type string" + }, + { + "title": "enforceEnum is valid only if enum property is defined", + "type": "object", + "dependencies": { + "enforceEnum": { + "type": "object", + "required": [ + "enum" + ] + } + }, + "errorMessage": "enforceEnum is valid only if enum property is defined" + }, + { + "title": "minItems, maxItems, uniqueItems are valid only for type array", + "type": "object", + "dependencies": { + "minItems": { + "type": "object", + "properties": { + "type": { + "enum": [ + "array", + "string[]", + "boolean[]", + "number[]", + "file[]" + ] + } + } + }, + "maxItems": { + "type": "object", + "properties": { + "type": { + "enum": [ + "array", + "string[]", + "boolean[]", + "number[]", + "file[]" + ] + } + } + }, + "uniqueItems": { + "type": "object", + "properties": { + "type": { + "enum": [ + "array", + "string[]", + "boolean[]", + "number[]", + "file[]" + ] + } + } + } + }, + "errorMessage": "minItems, maxItems are valid only for type array" + }, + { + "title": "maxFileSize, accept are valid only for file types", + "type": "object", + "dependencies": { + "maxFileSize": { + "oneOf": [ + { + "$ref": "#/$defs/OptimizedFileTypeField" + }, + { + "$ref": "#/$defs/FileTypeField" + } + ] + }, + "accept": { + "oneOf": [ + { + "$ref": "#/$defs/OptimizedFileTypeField" + }, + { + "$ref": "#/$defs/FileTypeField" + } + ] + } + }, + "errorMessage": "maxFileSize, accept are valid only for file types" + }, + { + "title": "editFormat, displayFormat, dataFormat are valid only for fields with type date or number", + "type": "object", + "dependencies": { + "editFormat": { + "$ref": "#/$defs/DateOrNumberField" + }, + "displayFormat": { + "$ref": "#/$defs/DateOrNumberField" + }, + "dataFormat": { + "$ref": "#/$defs/DateOrNumberField" + } + } + } + ] +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-sign-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-sign-properties.schema.json new file mode 100644 index 0000000000..1bc218e5cd --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-sign-properties.schema.json @@ -0,0 +1,25 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form-sign-properties.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "properties": { + "firstSignerFormFiller": { + "title": "First Signer Form Filler", + "description": "Specifies whether the signer is the first form filler.", + "type": "boolean" + }, + "workflowType": { + "title": "Workflow Type", + "enum": [ + "SEQUENTIAL", + "PARALLEL" + ], + "description": "Specifies the type of workflow for the sign.", + "type": "string" + }, + "signers": { + "$ref": "./adaptive-form-signer-properties.schema.json" + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-signer-properties.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-signer-properties.schema.json new file mode 100644 index 0000000000..eae69fe372 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form-signer-properties.schema.json @@ -0,0 +1,83 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form-signer-properties.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Signers Information", + "description": "Represents information about signers.", + "type": "object", + "additionalProperties": true, + "properties": { + "signerTitle": { + "title": "Signer Title", + "description": "The title or name of the signer.", + "type": "string" + }, + "email": { + "title": "Email Information", + "description": "Information about the signer's email address.", + "type": "object", + "properties": { + "type": { + "title": "Email Type", + "description": "Indicates whether the email value is sourced from form data or form configuration.", + "type": "string", + "enum": [ + "data", + "form" + ] + }, + "value": { + "title": "Email Address", + "description": "The email address value.", + "type": "string" + } + } + }, + "countryCode": { + "title": "Country Code", + "description": "Information about the country code for the phone number.", + "type": "object", + "properties": { + "type": { + "title": "Country Code Type", + "description": "Indicates whether the country code value is sourced from form data or form configuration.", + "type": "string", + "enum": [ + "data", + "form" + ] + }, + "value": { + "title": "Country Code Value", + "description": "The country code value.", + "type": "string" + } + } + }, + "phone": { + "title": "Phone Number", + "description": "Information about the signer's phone number.", + "type": "object", + "properties": { + "type": { + "title": "Phone Number Type", + "description": "Indicates whether the phone number value is sourced from form data or form configuration.", + "type": "string", + "enum": [ + "data", + "form" + ] + }, + "value": { + "title": "Phone Number Value", + "description": "The phone number value.", + "type": "string" + } + } + }, + "securityOption": { + "title": "Security Option", + "description": "Specifies the security option for the signer.", + "type": "string" + } + } +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form.schema.json b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form.schema.json new file mode 100644 index 0000000000..1b37a8641f --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/adaptive-form.schema.json @@ -0,0 +1,1438 @@ +{ + "$id": "classpath:/schema/0.14.1/adaptive-form.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "$defs": { + "FormElement": { + "allOf": [ + { + "$ref": "./adaptive-form-properties.schema.json" + }, + { + "$ref": "./adaptive-form-data-constraints.schema.json" + }, + { + "$ref": "./adaptive-form-property-restrictions.schema.json" + } + ] + }, + "TextField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "text-input", + "multiline-input" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "text-input", + "multiline-input" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "appliedCssClassNames", + "autocomplete", + "constraintMessages", + "dataFormat", + "dataLayer", + "dataRef", + "default", + "description", + "displayFormat", + "displayValueExpression", + "editFormat", + "emptyValue", + "enforceEnum", + "enabled", + "enum", + "enumNames", + "events", + "exclusiveMaximum", + "exclusiveMinimum", + "fieldType", + "format", + "id", + "label", + "lang", + "maximum", + "maxLength", + "minimum", + "minLength", + "name", + "pattern", + "placeholder", + "properties", + "readOnly", + "required", + "rules", + "screenReaderText", + "type", + "tooltip", + "validationExpression", + "visible" + ], + "errorMessage": { + "enum": "${0} property is not allowed in text-input" + } + }, + "errorMessage": { + "properties": { + "fieldType": "${0/fieldType} is not a valid TextField field type. It should be text-input" + } + } + } + }, + "NumberField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "const": "number-input" + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "type": { + "enum": [ + "number", + "integer" + ] + }, + "fieldType": { + "const": "number-input" + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "maximum", + "minimum", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "appliedCssClassNames", + "autocomplete", + "constraintMessages", + "dataFormat", + "dataLayer", + "dataRef", + "default", + "description", + "displayFormat", + "displayValueExpression", + "editFormat", + "enabled", + "enforceEnum", + "enum", + "enumNames", + "events", + "exclusiveMaximum", + "exclusiveMinimum", + "fieldType", + "id", + "label", + "lang", + "maximum", + "maxLength", + "minimum", + "minLength", + "name", + "pattern", + "placeholder", + "properties", + "readOnly", + "required", + "rules", + "screenReaderText", + "step", + "type", + "tooltip", + "validationExpression", + "visible" + ], + "errorMessage": { + "enum": "${0} property is not allowed in NumberField" + } + } + } + }, + "SwitchField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "switch", + "checkbox" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "switch", + "checkbox" + ] + }, + "enum": { + "type": "array", + "maxItems": 2 + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "checked", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "appliedCssClassNames", + "checked", + "constraintMessages", + "dataFormat", + "dataLayer", + "dataRef", + "default", + "description", + "enabled", + "enforceEnum", + "enum", + "enumNames", + "events", + "fieldType", + "id", + "label", + "name", + "properties", + "readOnly", + "required", + "rules", + "screenReaderText", + "tooltip", + "type", + "validationExpression", + "visible" + ], + "errorMessage": { + "enum": "${0} property is not allowed in SwitchField" + } + }, + "errorMessage": { + "properties": { + "fieldType": "${0/fieldType} is not a valid SwitchField field type. It should be either switch or checkbox" + } + }, + "anyOf": [ + { + "type": "object", + "required": [ + "enum" + ] + }, + { + "type": "object", + "properties": { + "type": { + "const": "boolean" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "DateField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "const": "date-input" + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "const": "date-input" + }, + "type": { + "const": "string" + }, + "format": { + "const": "date" + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "maximum", + "minimum", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "appliedCssClassNames", + "constraintMessages", + "dataFormat", + "dataLayer", + "dataRef", + "default", + "description", + "displayFormat", + "displayValueExpression", + "editFormat", + "enabled", + "enforceEnum", + "enum", + "enumNames", + "events", + "exclusiveMaximum", + "exclusiveMinimum", + "fieldType", + "format", + "id", + "label", + "lang", + "maximum", + "minimum", + "name", + "placeholder", + "properties", + "readOnly", + "required", + "rules", + "screenReaderText", + "step", + "tooltip", + "type", + "validationExpression", + "visible" + ], + "errorMessage": { + "enum": "${0} property is not allowed in DateField" + } + }, + "errorMessage": { + "properties": { + "fieldType": "${0/fieldType} is not a valid DateField field type. It should be date-input" + } + } + } + }, + "EmailField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "const": "email" + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "const": "email" + }, + "type": { + "const": "string" + }, + "format": { + "const": "email" + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "maximum", + "minimum", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "appliedCssClassNames", + "constraintMessages", + "dataLayer", + "dataRef", + "default", + "description", + "enabled", + "enforceEnum", + "enum", + "enumNames", + "events", + "fieldType", + "id", + "label", + "maxItems", + "minItems", + "name", + "placeholder", + "properties", + "readOnly", + "required", + "rules", + "screenReaderText", + "tooltip", + "type", + "uniqueItems", + "validationExpression", + "visible" + ], + "errorMessage": { + "enum": "${0} property is not allowed in EmailFIeld" + } + }, + "errorMessage": { + "properties": { + "fieldType": "${0/fieldType} is not a valid EmailField field type. It should be email" + } + } + } + }, + "SelectionField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "drop-down", + "checkbox-group" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "drop-down", + "checkbox-group" + ] + }, + "type": { + "enum": [ + "string", + "number", + "boolean", + "string[]", + "number[]", + "boolean[]" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "appliedCssClassNames", + "constraintMessages", + "dataLayer", + "dataRef", + "default", + "description", + "enabled", + "enforceEnum", + "enum", + "enumNames", + "events", + "fieldType", + "id", + "label", + "maxItems", + "minItems", + "name", + "placeholder", + "properties", + "readOnly", + "required", + "rules", + "screenReaderText", + "tooltip", + "type", + "uniqueItems", + "validationExpression", + "visible" + ], + "errorMessage": { + "enum": "${0} property is not allowed in SelectionField" + } + }, + "required": [ + "enum" + ], + "errorMessage": { + "required": { + "enum": "Options are missing from selection. Add an empty enum array" + }, + "properties": { + "fieldType": "${0/fieldType} is not a valid SelectionField field type. It should be either drop-down or checkbox-group" + } + } + } + }, + "RadioGroupField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "const": "radio-group" + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "const": "radio-group" + }, + "type": { + "enum": [ + "string", + "number", + "boolean" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "appliedCssClassNames", + "constraintMessages", + "dataLayer", + "dataRef", + "default", + "description", + "enabled", + "enforceEnum", + "enum", + "enumNames", + "events", + "fieldType", + "id", + "label", + "name", + "placeholder", + "properties", + "readOnly", + "required", + "rules", + "screenReaderText", + "tooltip", + "type", + "validationExpression", + "visible" + ], + "errorMessage": { + "enum": "${0} property is not allowed in RadioGroupField" + } + }, + "required": [ + "enum" + ], + "errorMessage": { + "properties": { + "fieldType": "${0/fieldType} is not a valid radio group field type. It should be radio-group" + } + } + } + }, + "FileField": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "const": "file-input" + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "file-input" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "enum", + "enumNames", + "label", + "properties", + "readOnly", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "accept", + "appliedCssClassNames", + "constraintMessages", + "dataLayer", + "dataRef", + "default", + "description", + "enabled", + "enum", + "enumNames", + "events", + "fieldType", + "format", + "id", + "label", + "maxFileSize", + "maxItems", + "minItems", + "name", + "placeholder", + "properties", + "readOnly", + "required", + "rules", + "screenReaderText", + "tooltip", + "type", + "uniqueItems", + "validationExpression", + "visible" + ], + "errorMessage": { + "enum": "${0} property is not allowed in file-input" + } + } + } + }, + "Button": { + "title": "Clickable Button Field", + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "button" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "const": "button" + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "label", + "properties", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "appliedCssClassNames", + "dataLayer", + "dataRef", + "description", + "enabled", + "events", + "fieldType", + "id", + "label", + "name", + "properties", + "rules", + "screenReaderText", + "tooltip", + "visible" + ], + "errorMessage": { + "enum": "${0} property is not allowed in Button" + } + } + } + }, + "StaticField": { + "title": "Static Field represents the Field that do not capture value from the user but can be", + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "plain-text" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "plain-text" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "properties", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "appliedCssClassNames", + "dataLayer", + "dataRef", + "events", + "fieldType", + "id", + "name", + "properties", + "richText", + "rules", + "value", + "visible" + ], + "errorMessage": { + "enum": "${0} property is not allowed in StaticField" + } + } + } + }, + "Image": { + "title": "Image Component", + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "image" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "image" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "altText", + "description", + "properties", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + "altText", + "appliedCssClassNames", + "dataLayer", + "dataRef", + "description", + "events", + "fieldType", + "id", + "name", + "properties", + "rules", + "value", + "visible" + ], + "errorMessage": { + "enum": "${0} property is not allowed in Image" + } + } + } + }, + "Panel": { + "if": { + "type": "object", + "properties": { + "fieldType": { + "const": "panel" + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "allOf": [ + { + "$ref": "#/$defs/Container" + }, + { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "panel" + ] + }, + "type": { + "enum": [ + "object", + "array" + ] + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "description", + "enabled", + "label", + "maxItems", + "minItems", + "maxOccur", + "minOccur", + "repeatable", + "properties", + "required", + "value", + "visible" + ] + } + } + }, + "propertyNames": { + "enum": [ + ":type", + ":items", + ":itemsOrder", + "allowedComponents", + "appliedCssClassNames", + "columnClassNames", + "columnCount", + "constraintMessages", + "dataLayer", + "dataRef", + "description", + "enabled", + "events", + "fieldType", + "id", + "items", + "label", + "lang", + "maxItems", + "maxOccur", + "minItems", + "minOccur", + "name", + "properties", + "readOnly", + "repeatable", + "required", + "rules", + "screenReaderText", + "tooltip", + "type", + "uniqueItems", + "validationExpression", + "visible" + ], + "errorMessage": { + "enum": "${0} property is not allowed in Panel" + } + }, + "anyOf": [ + { + "required": [ + "items" + ] + }, + { + "required": [ + ":items", + ":itemsOrder" + ] + } + ] + } + ] + } + }, + "Captcha": { + "title": "Captcha Component", + "if": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "captcha" + ] + } + }, + "required": [ + "fieldType" + ] + }, + "then": { + "type": "object", + "properties": { + "fieldType": { + "enum": [ + "captcha" + ] + } + }, + "propertyNames": { + "enum": [ + ":type", + "appliedCssClassNames", + "dataLayer", + "description", + "enabled", + "events", + "fieldType", + "id", + "label", + "name", + "properties", + "readOnly", + "required", + "tooltip", + "type", + "validationExpression", + "visible", + "captchaDisplayMode", + "captchaProvider", + "captchaSiteKey" + ], + "errorMessage": { + "enum": "${0} property is not allowed in Captcha" + } + } + } + }, + "CustomElement": { + "if": { + "allOf": [ + { + "type": "object", + "not": { + "required": [ + "fieldType" + ] + } + }, + { + "type": "object", + "required": [ + ":type" + ] + } + ] + }, + "then": { + "type": "object", + "properties": { + ":type": { + "type": "string" + }, + ":itemsOrder": { + "$ref": "#/$defs/ColonItemsOrder" + }, + ":items": { + "$ref": "#/$defs/ColonItems" + } + }, + "required": [ + ":type" + ], + "additionalProperties": true, + "dependencies": { + ":items": { + "type": "object", + "required": [ + ":type", + ":itemsOrder" + ] + } + } + } + }, + "Child": { + "allOf": [ + { + "anyOf": [ + { + "type": "object", + "required": [ + "fieldType" + ] + }, + { + "type": "object", + "required": [ + ":type" + ] + }, + { + "type": "object", + "required": [ + "type" + ] + }, + { + "type": "object", + "required": [ + "enum" + ] + }, + { + "type": "object", + "required": [ + "items" + ] + }, + { + "type": "object", + "required": [ + ":items", + ":itemsOrder" + ] + } + ] + }, + { + "allOf": [ + { + "$ref": "#/$defs/FormElement" + }, + { + "$ref": "#/$defs/FileField" + }, + { + "$ref": "#/$defs/NumberField" + }, + { + "$ref": "#/$defs/DateField" + }, + { + "$ref": "#/$defs/EmailField" + }, + { + "$ref": "#/$defs/SwitchField" + }, + { + "$ref": "#/$defs/SelectionField" + }, + { + "$ref": "#/$defs/RadioGroupField" + }, + { + "$ref": "#/$defs/TextField" + }, + { + "$ref": "#/$defs/Panel" + }, + { + "$ref": "#/$defs/Button" + }, + { + "$ref": "#/$defs/StaticField" + }, + { + "$ref": "#/$defs/Image" + }, + { + "$ref": "#/$defs/Captcha" + }, + { + "$ref": "#/$defs/CustomElement" + } + ] + } + ], + "errorMessage": "Object doesn't match any field type" + }, + "Items": { + "type": "array", + "items": { + "$ref": "#/$defs/Child" + } + }, + "ColonItems": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Child" + } + }, + "ColonItemsOrder": { + "type": "array", + "items": { + "type": "string" + } + }, + "Container": { + "type": "object", + "properties": { + "items": { + "$ref": "#/$defs/Items" + }, + ":items": { + "$ref": "#/$defs/ColonItems" + }, + ":itemsOrder": { + "$ref": "#/$defs/ColonItemsOrder" + }, + "anyOf": [ + { + "required": [ + "items" + ] + }, + { + "required": [ + ":items", + ":itemsOrder" + ] + } + ] + } + } + }, + "type": "object", + "allOf": [ + { + "$ref": "./adaptive-form-aem-responsive-grid-properties.schema.json" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + }, + "events": { + "type": "object", + "propertyNames": { + "anyOf": [ + { + "enum": [ + "submit", + "reset", + "initialize" + ] + }, + { + "pattern": "custom:[a-zA-Z0-9]+" + } + ] + } + }, + ":type": { + "type": "string", + "title": "A hint to the rendering engine for rendering custom components." + }, + "action": { + "title": "URL indicating the endpoint where the data would be submitted when submit event is triggered", + "type": "string" + }, + "adaptiveform": { + "anyOf": [ + { + "const": "0.11.0-Pre" + }, + { + "const": "0.12.0" + }, + { + "const": "0.12.1" + }, + { + "const": "0.12.5" + }, + { + "const": "0.13.0" + }, + { + "const": "0.14.0" + }, + { + "const": "0.14.1" + } + ] + }, + "description": { + "type": "string", + "title": "A user friendly description of the form" + }, + "fieldType": { + "const": "form" + }, + "id": { + "type": "string", + "title": "unique identifier for a form element" + }, + "items": { + "$ref": "#/$defs/Items" + }, + ":items": { + "$ref": "#/$defs/ColonItems" + }, + ":itemsOrder": { + "$ref": "#/$defs/ColonItemsOrder" + }, + "lang": { + "type": "string", + "title": "The language in which the Form was authored.", + "description": "The language needs to be defined as per the [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) tag" + }, + "metadata": { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "grammar": { + "const": "json-formula-1.0.0" + }, + "formattingLanguage": { + "const": "xfa-picture-clause" + } + }, + "required": [ + "version" + ] + }, + "properties": { + "title": "An object containing custom properties that can be modified via rules as well.", + "type": "object", + "properties": { + "fd:dor": { + "$ref": "./adaptive-form-container-dor-properties.schema.json" + }, + "fd:signerInfo": { + "$ref": "./adaptive-form-sign-properties.schema.json" + } + }, + "additionalProperties": true + }, + "rules": { + "type": "object", + "propertyNames": { + "enum": [ + "properties" + ] + } + }, + "title": { + "type": "string", + "maxLength": 140, + "title": "A user friendly one line title for the form" + } + } + } + ], + "anyOf": [ + { + "required": [ + "metadata", + "items", + "adaptiveform", + "fieldType" + ] + }, + { + "required": [ + "metadata", + ":items", + ":itemsOrder", + "adaptiveform", + "fieldType" + ] + } + ] +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/schema/0.14.1/form.json b/bundles/af-core/src/test/resources/schema/0.14.1/form.json new file mode 100644 index 0000000000..876d7b4c85 --- /dev/null +++ b/bundles/af-core/src/test/resources/schema/0.14.1/form.json @@ -0,0 +1,14 @@ +{ + "items": [ + ], + "fieldType" : "form", + "metadata": { + "action": "/a/b", + "dataUrl": "/c/d", + "locale": "en-us", + "grammar": "json-formula-1.0.0", + "version": "1.0.0" + }, + "adaptiveform":"0.14.1", + ":type": "core/fd/components/form/container/v2/container" +} \ No newline at end of file diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/_cq_dialog/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/_cq_dialog/.content.xml index 119e49ce73..4ace70d72e 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/_cq_dialog/.content.xml +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/_cq_dialog/.content.xml @@ -83,7 +83,7 @@ sling:resourceType="granite/ui/components/coral/foundation/form/hidden" ignoreData="{Boolean}true" name="./specVersion" - value="0.14.0"/> + value="0.14.1"/>