Tagged with Validation
I've been working with Vue 3 Beta and RC (currently in RC5) and early on I needed some validation but the Vue stalwards of vuelidate and vee-validate weren't working with the Composition API early on. What was I do to?
After some searching I ran into class-validator library. It got me thinking about how to separate the validation from the UI like I usually do in the server.
I thought I'd run you though a little example. If you want to take a look at the project, I have an example on GitHub with tags for before and after:
I'm working on an example to explore some more complex modeling in EF (for SQL and NoSQL) but that's not ready so I thought I'd use it as a bed for some Validation testing I'm doing. The result is some exploration of the FluentValidation project that I haven't had time to dig into until now.
Validation is an interesting exercise in ASP.NET (Core) and trying to get it correct is quite difficult. Ultimately in this day of SPAs and mobile apps, we need a solution that handles the client and the server. If you don't validate on the server it just doesn't matter.
FluentValidation is a replacment for the existing validation attributes (DataAnnotations) that you might already be using. The idea is to separate the validation from the classes. To be clear, this doesn't replace setting up your Entity Framework types with Fluent API this is about server-side validation only. Think of it as a clearer way to define rules for validation of your models or DTOs.
As I've been on the mend lately, i've been looking deep into how Validation should work in Silverlight. As I am trying to expand some of hte validation scenarios in Silverlight (in my Niagara project), I'd like to see how you are feeling about Validaiton.
While Niagara is not going to require that you specify your validation attributes using its DSL, there are some benefits I think we can get by loosely coupling the validation. To that end, i've come up with a very first draft of the DSL to define the attributes. I've decided that instead of being very English-like, to mimic the "M" style of language. Here is my take: