Skip to content

Conversation

@madsrasmussen
Copy link
Contributor

@madsrasmussen madsrasmussen commented Nov 12, 2025

This PR adds support for client-side validation of Data Type configuration properties.

How to use:
As part of the manifest, it is now possible to enable mandatory validation.

{
  type: 'propertyEditorUi',
  ...
  meta: {
    ...		
    settings: {
      properties: [
        {
          alias: 'myConfig',
          label: 'My Config',
          propertyEditorUiAlias: 'Umb.PropertyEditorUi.RadioButtonList',
          validation: {
            mandatory: true,
            mandatoryMessage: 'Oh oh'
          }
        }
      ]
    }
  }
}

Introduces a 'validation' field to the PropertyEditorSettingsProperty interface, allowing configuration of mandatory status and custom mandatory messages for property editor settings.
Copilot AI review requested due to automatic review settings November 12, 2025 07:49
Copilot finished reviewing on behalf of madsrasmussen November 12, 2025 07:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for client-side validation of Data Type configuration properties, specifically enabling mandatory field validation for properties configured in property editor manifests. The feature allows developers to specify validation rules (mandatory and mandatoryMessage) in the manifest settings to enforce required configuration values.

  • Passes validation configuration from PropertyEditorSettingsProperty to the umb-property element
  • Adds validation interface definition to support mandatory field validation with custom error messages

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Umbraco.Web.UI.Client/src/packages/data-type/components/property-editor-config/property-editor-config.element.ts Updated to pass the validation property from PropertyEditorSettingsProperty to umb-property element
src/Umbraco.Web.UI.Client/src/packages/core/property-editor/extensions/property-editor.extension.ts Added validation interface to PropertyEditorSettingsProperty to support mandatory field configuration with optional error messages

Comment on lines +72 to +75
validation?: {
mandatory: boolean;
mandatoryMessage?: string | null;
};
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation property in PropertyEditorSettingsProperty has an incomplete type definition. It should extend UmbPropertyTypeValidationModel to include the optional regEx and regExMessage properties for consistency with the validation model used throughout the codebase.

Current definition:

validation?: {
    mandatory: boolean;
    mandatoryMessage?: string | null;
};

Should be:

validation?: {
    mandatory: boolean;
    mandatoryMessage?: string | null;
    regEx?: string | null;
    regExMessage?: string | null;
};

Or better yet, import and use the existing type:

validation?: UmbPropertyTypeValidationModel;

This ensures type compatibility when passing property.validation to the umb-property element which expects UmbPropertyTypeValidationModel.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants