I'm creating an API using .NET's WEBAPI. I would like for clients of this API to be told the validation rules so that they can be implemented without the client developers having to trawl through documentation.
Developing in .NET MVC, you can define the validation using data annotations and then the Razor view engine "automagically" creates the client side implementations of this. I would like my API to provide at least the "rules" component to client developers so they might get the same type of advantage.
Does anyone know of any existing "standard" way of expressing these validation rules?
Thinking something like
{entities : [entity { name: entityname, properties : [ {name : propertyname, required : True, MinLength : 0, MaxLength : 50, DataType : email }]}]}
Thinking that the client can get the validation rules in this type of format at the start of a session, then apply the rules dynamically?!?!