title: How can I create a custom JSchemaGenerationProvider that adds a title attribute to both the model and to the model's properties?
body: <p>I am using the Newtonsoft.Json.Schema package to generate JSON Schemas.  Currently, the schemas contain no 'title' property, so I created a custom provider following <a href="http://www.newtonsoft.com/jsonschema/help/html/CreateCustomProvider.htm" rel="nofollow">the example in the documentation</a> , however the provider only runs on the parent node and skips all the property nodes.</p>
  
  <pre><code>class User {
      public int Id { get; set; }
      public string Name { get; set; }
      public DateTime CreatedDate { get; set; }
  }
  
  class TitleProvider : JSchemaGenerationProvider {
      public override JSchema GetSchema(JSchemaTypeGenerationContext context) {
          var schema = new JSchemaGenerator().Generate(context.ObjectType);
          schema.Title = "foo";
          return schema;
      }
  }
  
  public class Program {
      public static void Main() {
          var generator = new JSchemaGenerator();
          generator.GenerationProviders.Add(new TitleProvider());
          var schema = generator.Generate(typeof(User));
  
          Console.WriteLine(schema);
      }
  }
  // OUTPUT:
  //{
  //  "title": "foo",
  //  "type": "object",
  //  "properties": {
  //    "Id": {
  //      "type": "integer"
  //    },
  //    "Name": {
  //      "type": [
  //        "string",
  //        "null"
  //      ]
  //    },
  //    "CreatedDate": {
  //      "type": "string"
  //    }
  //  },
  //  "required": [
  //    "Id",
  //    "Name",
  //    "CreatedDate"
  //  ]
  //}
  </code></pre>
  
  <p><strong>How do I configure this provider to run on property nodes (similar to the example provided in the linked documentation)?</strong></p>
  
  <p>Other Notes:</p>
  
  <ul>
  <li>if you return null from the provider <code>GetSchema</code> method, it does iterate over all the properties (which I observed in debugger), though it doesn't have the functionality I want then</li>
  <li>if I add in an if block to skip when the current context.ObjectType has properties, it does iterate through all the properties, but only adds the title to the first property</li>
  </ul>