IMHO it would be great to allow the blazor components to enforce parameter contracts using the existing data annotations; eg.
[Required,Parameter,StringLength(80)]
string Name { get; set; }
this would avoid a lot of boilerplate code with the components and/or replication of feature that exist in data annotation libraries today.
I think it is a bad idea to mix between the two. The Parameter attribute fulfills a different functionality than that of the data annotations. And the Parameter attribute is specific to Blazor.
IMHO I believe the Blazor Parameter attribute represents the component view state and with that in mind data annotations are in fact the correct attributes to use with Blazor parameters/data bindings to enforce parameter/model validation on both client and server using common/shared logic by way of the existing validations.
@enetstudio yes, the Parameter attribute is specific to Blazor; again IMHO there is nothing stopping Blazor from understanding the existing DataAnnonations and applying/generating checks accordingly. I'm not suggesting the Blazor ParameterAttribute be moved/changed.
Similar ideas (required parameters) are already planned here https://github.com/aspnet/Blazor/issues/1#issuecomment-363034967
Full validation (not related to parameters) is discussed here aspnet/AspNetCore#5460.
Validation is being tracked in aspnet/AspNetCore#5460.
FYI the syntax [Parameter, Required] means the same thing as [Parameter][Required] so will work, assuming there ends up being a validation system that works with DataAnnotations attributes.
Most helpful comment
Similar ideas (required parameters) are already planned here https://github.com/aspnet/Blazor/issues/1#issuecomment-363034967
Full validation (not related to parameters) is discussed here aspnet/AspNetCore#5460.