Skip to content

Server side validation for property editors (multiple text strings and block list) #18581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

AndyButland
Copy link
Contributor

@AndyButland AndyButland commented Mar 5, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

Description

This adds server-side validation to the multiple text strings, to ensure that the number of entries provided matches the configured minimum and maximum.

For the block list, the validation was already in place, so here all I've done is add unit tests.

As well as the unit tests, to verify manually I've used Swagger and manipulated values to the PUT /umbraco/management/api/v1.1/document/{id}/validate endpoint. You should find if you supply collection of strings or blocks above or below the configured range, you'll get a localized validation message in response.

@AndyButland AndyButland changed the title Server-side validation for multiple text strings property editor. Server side validation for property editors (multiple text strings) Mar 5, 2025
Copy link
Contributor

@nikolajlauridsen nikolajlauridsen left a comment

Choose a reason for hiding this comment

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

Looks good 👍

I found one minor thing, if no max configuration was provided for the multiple text strings was provided you weren't allowed to publish any multiple text strings because the max configuration defaults to 0 because it's not nullabe, I've added a test showing this and fixed the issue 👍

Feel free to merge if you're happy with my changes :D

@AndyButland
Copy link
Contributor Author

Thanks @nikolajlauridsen, and good catch on the max configuration.

@AndyButland AndyButland enabled auto-merge (squash) March 6, 2025 09:29
@AndyButland AndyButland merged commit 45ea6a3 into v15/dev Mar 6, 2025
20 of 21 checks passed
@AndyButland AndyButland deleted the v15/feature/server-validation-multi-text-string branch March 6, 2025 09:48
@AndyButland AndyButland changed the title Server side validation for property editors (multiple text strings) Server side validation for property editors (multiple text strings and block list) Mar 6, 2025
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