FSharpPlus icon indicating copy to clipboard operation
FSharpPlus copied to clipboard

Add some extensions methods for validation

Open rodriguestiago0 opened this issue 3 years ago • 3 comments

rodriguestiago0 avatar Nov 14 '22 21:11 rodriguestiago0

Maybe an alias then?

That's an old discussion we have here. This library contains highly reusable code We can create a module with some CEs, but as you can see defining aliases are one-liner.

My original view was that F#+ is kind of a library for libraries, meaning that you can have your own enterprise specific libraries where you take what you need, the way you need, this is giving a specific name and closing it over certain type parameters.

I had feedback that some users did that at the beginning, which lead to the desire of making CEs more parameterizable, we did that in v1.2

However, if everybody is strongly for providing aliases we can evaluate the impact. Maybe provide a script with those aliases or a separate package.

gusty avatar Nov 15 '22 05:11 gusty

There seems to be prior work that we can reuse some of the thoughts from. For dynamic languages we have:

https://clojure.org/about/spec https://github.com/jquense/yup

While for F# we have

https://github.com/lfr/FSharp.Domain.Validation https://github.com/JamesRandall/AccidentalFish.FSharp.Validation#built-in-validators

and the new library:

https://github.com/pimbrouwers/Validus#built-in-validators

Perhaps we can reuse some of the design work while being more in line with the vision that you promote in this PR (possible to write strictly typed validations instead of stringly typed validation keys/messages)?

wallymathieu avatar Nov 20 '22 16:11 wallymathieu

Some of the operators seems to not have stabilised in Validus yet. The different libraries all have their built in validators that we can look at. Seems like there is some polymorphism going on for some of the validators.

wallymathieu avatar Nov 20 '22 17:11 wallymathieu