Configure Swagger javax validation Constraints on DTOs
<p>I'm using Swagger (1.5.8).  I want my <code>swagger.json</code> definition to detect the <code>javax.validation</code> <a href="http://beanvalidation.org/1.0/spec/" rel="noreferrer">JSR-303</a> annotations on my DTOs, so that I can document my API's validation constraints.</p>

<p>I would expect a <code>@Min</code> annotation (<a href="https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-jaxrs/src/test/java/io/swagger/resources/ResourceWithValidation.java" rel="noreferrer">like this example</a>) would show something about the minimum value (44), but it does not.</p>

<pre><code>@POST
@ApiOperation(value = "post", httpMethod = "POST")
public Response post(
        @QueryParam("id") @NotNull @Min(44) Integer id) {...}
</code></pre>

<p>The resulting <code>swagger.json</code> for this is:</p>

<pre><code>"/foo": {
  "post": {
    "operationId": "post",
    ...
    "parameters": [
      {
        "in": "body",
        "name": "id",
        "description": "id",
        "required": false,
        "schema": {
          "type": "integer",
          "format": "int32"
        }
      }
</code></pre>

<p>Swagger has <a href="https://github.com/swagger-api/swagger-core/pull/1618" rel="noreferrer">closed the pull request for this functionality</a>, but I'm unclear where/how it is able to be consumed in the Swagger definition.</p>

<p>I want to be able to do things like:</p>

<h2>FooController</h2>

<pre><code>@POST
public void postFoo(@Valid @RequestBody FooDTO fooDto) {...}
</code></pre>

<h2>FooDTO</h2>

<pre><code>public class FooDTO {
    @NotNull
    @Size(min = 1, max = 100)
    private Integer myInt;
}
</code></pre>

<h2>Desired/Expected swagger.json Output:</h2>

<pre><code>"FooDTO": {
  "type": "object",
  "required": [
    "myInt"
  ],
  "properties": {
    "myInt": {
      "type": "number",
      "format": "integer",
      "minimum": "1",
      "maximum": "100",
 ...
</code></pre>

<p>What's the preferred way to configure Swagger Modules/Plugins to enable things like <a href="https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-core/src/main/java/io/swagger/jackson/ModelResolver.java" rel="noreferrer"><code>ModelResolver</code></a> and <a href="https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-hibernate-validations/src/main/java/io/swagger/validator/BeanValidator.java" rel="noreferrer"><code>BeanValidator</code></a>, so that they'll inspect the annotations on my DTO's?</p>