title: Generate JSON schema from Java class
body: <p>I have a POJO class:</p>
  <pre><code>public class Stock {
   int id;
   String name;
   Date date;
  }
  </code></pre>
  <p>Are there any annotations or development framework/API that can convert POJO to JSON schema like below:</p>
  <pre><code>{&quot;id&quot;:
        {             
          &quot;type&quot; : &quot;int&quot;
        },
  &quot;name&quot;:{   
          &quot;type&quot; : &quot;string&quot;
         }
  &quot;date&quot;:{
          &quot;type&quot; : &quot;Date&quot;
        }
  }
  </code></pre>
  <p>And also I can expand the schema to add information like <code>&quot;Required&quot; : &quot;Yes&quot;</code>, description for each field, etc., by specifying some annotations or configurations on POJO and can generate JSON Schema like below:</p>
  <pre><code>{&quot;id&quot;:
        {             
          &quot;type&quot; : &quot;int&quot;,
          &quot;Required&quot; : &quot;Yes&quot;,
          &quot;format&quot; : &quot;id must not be greater than 99999&quot;,
          &quot;description&quot; : &quot;id of the stock&quot;
        },
  &quot;name&quot;:{   
          &quot;type&quot; : &quot;string&quot;,
          &quot;Required&quot; : &quot;Yes&quot;,
          &quot;format&quot; : &quot;name must not be empty and must be 15-30 characters length&quot;,
          &quot;description&quot; : &quot;name of the stock&quot;
         }
  &quot;date&quot;:{
          &quot;type&quot; : &quot;Date&quot;,
          &quot;Required&quot; : &quot;Yes&quot;,
          &quot;format&quot; : &quot;must be in EST format&quot;,
          &quot;description&quot; : &quot;filing date of the stock&quot;
        }
  }
  </code></pre>