fabiomaffioletti / jsondoc

Easily generate docs and playground for your RESTful API
http://jsondoc.org
MIT License
264 stars 127 forks source link

Handle validation constraints groups within dto #170

Open paolinux79 opened 8 years ago

paolinux79 commented 8 years ago

Currently I am using spring validation group in order to keep just one dto for both object creation and update. An example follows:

@NotNull(groups = UpdateObject.class)
@Getter @Setter private Integer id;

@NotNull(groups = CreateObject.class)
@Max(groups = {CreateObject.class, UpdateObject.class}, value = 3L)
@Getter @Setter private Integer typeId;

@NotNull(groups = CreateObject.class)
@NotBlank
@Length(min=10)
@Getter @Setter private String title;

Thie typeId code is rendered by jsondoc with Format: may not be null, must be less than or equal to 3 regardless the two different group used.

Maybe something like this:

Format: CreateObject: may not be null, must be less than or equal to 3
             UpdateObject: must be less than or equal to 3

would be very nice!

fabiomaffioletti commented 8 years ago

See #171