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 Mar 4, 2025
Conversation
…floating point values can be be accessed as doubles or ints.
…-configured-whole-numbers # Conflicts: # tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/DecimalValueEditorTests.cs
…-configured-whole-numbers
nikolajlauridsen
approved these changes
Mar 4, 2025
Contributor
nikolajlauridsen
left a comment
There was a problem hiding this comment.
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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
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
intrather thandoubleas 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.