title: Validate object using json schema in C#
body: <p>I'm trying to use a json shema to validate an incoming objet parameter in a C# api.
  Here is my api proto : </p>
  
  <pre><code>void BuildSqlQueryFromSegment(JoinDefinition jsonDef);
  </code></pre>
  
  <p>JsonDefinition is a complex objects, with lots of properties. Properties values are depending each other, this is why simple validateur attribute like Required, Min, Max can't be used here.</p>
  
  <p>One solution would be to pass a string instead of the type object : </p>
  
  <pre><code>void BuildSqlQueryFromSegment(string jsonDef) {
      // Check shema here, using Json.NET Schema
      // if ok, deserialize and get the JsonDefition object instance
  }
  </code></pre>
  
  <p>I'm able to implment this quite easily, but i find this solution not smart.</p>
  
  <p>What i'm looking for is something like this : </p>
  
  <pre><code>void BuildSqlQueryFromSegment([SchemaValidation('MySchemaResourceHere')] JoinDefinition jsonDef);
  </code></pre>
  
  <p>Does this kind of attribute exist ? If not, how can i implement it ? How can i act on incoming response json string to check the schema ?</p>
  
  <p>Thanks for your help.</p>