Skip to content

Fix issue with server validation from dictionary configuration where floating point values can be be accessed as doubles or ints#18508

Merged
nikolajlauridsen merged 4 commits intov15/devfrom
v15/bugfix/decimal-server-validation-with-configured-whole-numbers
Mar 4, 2025
Merged

Fix issue with server validation from dictionary configuration where floating point values can be be accessed as doubles or ints#18508
nikolajlauridsen merged 4 commits intov15/devfrom
v15/bugfix/decimal-server-validation-with-configured-whole-numbers

Conversation

@AndyButland
Copy link
Copy Markdown
Contributor

@AndyButland AndyButland commented Feb 28, 2025

Prerequisites

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

Issue found in testing decimal property editor server-side validation introduced in #18428

Description

I found an issue here when we have min/max/step values for the decimal property editor configuration as whole numbers. When deserialised, these come as int rather than double as we'd anticipated in the linked PR. If configured as a decimal value, we get doubles.

So I've put in a special cases to handle this.

The unit test verifies that this works, but could be my casting code could be simplified. It looks very verbose but was the only thing I could get to work! But if you have a suggestion to make that a little more terse, I'm all ears.

To manually verify, see the notes on the linked PR.

Should be cherry-picked to the release branch once merged.

AndyButland and others added 2 commits March 4, 2025 13:15
…-configured-whole-numbers

# Conflicts:
#	tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/DecimalValueEditorTests.cs
Copy link
Copy Markdown
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, tests good.

I do agree the cast is a bit weird, but I can't seem to find a better way either

@nikolajlauridsen nikolajlauridsen enabled auto-merge (squash) March 4, 2025 13:13
@nikolajlauridsen nikolajlauridsen merged commit a7f5b14 into v15/dev Mar 4, 2025
21 checks passed
@nikolajlauridsen nikolajlauridsen deleted the v15/bugfix/decimal-server-validation-with-configured-whole-numbers branch March 4, 2025 13:46
nikolajlauridsen added a commit that referenced this pull request Mar 4, 2025
…floating point values can be be accessed as doubles or ints (#18508)

* Fix issue with server validation from dictionary configuration where floating point values can be be accessed as doubles or ints.

* Fixed typo in comment.

---------

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
AndyButland added a commit that referenced this pull request Mar 4, 2025
…floating point values can be be accessed as doubles or ints (#18508)

* Fix issue with server validation from dictionary configuration where floating point values can be be accessed as doubles or ints.

* Fixed typo in comment.

---------

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
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.

3 participants