0
import javax.validation.constraints.Size;

class User {
    @Size(min = 3)
    private String name;

    private String email;

    @JsonCreator
    public User(@JsonProperty(value = "name", required = true) String name, 
                @JsonProperty(value = "email") String email) {
        this.name = name;
        this.email = email;
    }
}

Both are showed as required, api.json:

{"type":"object","required":["email","name"],"properties":{"name":{"type":"string"},"email":{"type":"string"}}}

@Size is not working, in api.json

"email":{"type":"string"}

but must be

{
    "type": "string",
    "minLength": 2
}

What I should add to work properly?

I am using compile group: "io.springfox", name: "springfox-swagger2", version: "2.6.1"

Romper
  • 2,009
  • 3
  • 24
  • 43

1 Answers1

0

I check this problem as an issue in the springfox github project:

https://github.com/springfox/springfox/issues/987

That´s a issue about size annotation that has been resolved in springfox-swagger2 (2.3.1).

Rafael Manzoni
  • 627
  • 5
  • 13