KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'd like to validate an input on a Web API REST command. I'd like it to work something like State below being decorated with an attribute that limits the valid values for the parameter. public class Item { ... // I want State to only be one of "New", "Used", or "Unknown" [Required] [ValidValues({"New", "Used", "Unknown"})] public string State { get; set; } [Required] public string Description { get; set; } ... } Is there a way to do this without going against the grain of Web API. Ideally the approach would be similar to Ruby on Rails' custom validation .
Tags (comma-separated)
Save Edits
Cancel