I have a spring boot app that I have implemented JSR validation groups in.
@Size(max=100, groups = {SomeGroup.class})
@Size(max=50, groups = {SomeOtherGroup1.class,SomeOtherGroup2.class})
private String someString;
I am trying to get these groups reflected in my API documentation, but with no luck. I am currently using springfox 3.0. Is there a way to accomplish this with springfox? If not are there other documentation frameworks that can handle displaying what groups a field is required for?
Thanks in advance, Brian
I wrote a ModelPropertyBuilderPlugin similar to what is here: https://github.com/springfox/springfox/issues/2739
My swagger page now shows something similar to:
example: someString
x-1-validation-type-Size: groups: SomeGroup | other attributes: min: 0, max: 100
x-2-validation-type-Size: groups: SomeOtherGroup1, SomeOtherGroup2 | other attributes: min: 0, max: 50
description of someString
creating a list of springfox.documentation.service.VendorExtension
and then setting it like below.
context.getSpecificationBuilder().vendorExtensions(extensions);
context.getBuilder().extensions(extensions);