Server side validation for property editors (integer, decimal and slider)#18428
Conversation
nikolajlauridsen
left a comment
There was a problem hiding this comment.
Overall looks good, just a few minor nitpicky things.
Not too worried about doing the conversion multiple times, especially not when it's so nicely wrapped up.
In regards to the dictionary, some of the new property editors comes with typed configurations which is optimal, the dictionary is legacy, but I don't think it's necessary to convert these to strongly typed in the validators, however constants might be nice 😄 I Love the pattern in the base class though 🤩
src/Umbraco.Core/PropertyEditors/Validators/ConfigurationValidatorBase.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Core/PropertyEditors/Validators/ConfigurationValidatorBase.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
|
This is updated now to reflect the earlier comments and to now handle the server-side validation for the integer, decimal and slider property editors. So it's ready for another look over. To test I've been using Swagger, using the PUT endpoint for updating a document and amending the provided value such that it triggers the expected validation, and reviewing the output. Plus there are unit tests for all the validations being made. Oh, and if you could help me out with the Danish translations, that would be lovely. Thanks! |
nikolajlauridsen
left a comment
There was a problem hiding this comment.
Looks good to me 👍 I've added danish translations
# Conflicts: # src/Umbraco.Core/EmbeddedResources/Lang/da.xml # src/Umbraco.Core/EmbeddedResources/Lang/en.xml
I've implemented the server side property editor validation for the integer property editor. Looks to work as expected and I've added unit tests to verify, but wanted to check a couple of things:
min,maxandstepvalues. At very least I could move these into constants. But do you think we need more typing here? I.e. should I be converting some strongly typed configuration model and using that (and if so, is there an example of how you go from the dictionary to this typed representation?).object?tointin both the min/max and step validator. The code is reused and it's a cheap operation, so I wasn't sure it was valuable to create a combined validator like I saw you were working on for the more complex JSON values where we need to deserialize. But maybe you think that would be valuable or more consistent.