Reputation: 327
My question is pretty simple: having rest controller's params like
( @RequestBody Wrapper<Request> requestBody){...}
i got to customize UI view of model Wrapper<Request>
. It has some fields and I use it from different starter. Im able to put @Schema(required=true) on the field of Request, cause it's located in my module, but what about Wrapper ? Thx.
Upvotes: 0
Views: 642
Reputation: 327
This is related to #1490.The way to configure this is to create a custom alternateTypeRules in the Docket config. For e.g. if you have an immutable MyClass that generates ImmutableMyClass, then we would add a rule for it as shown below.
@Bean
public Docket docket() {
return new Docket(DocumentationType.SWAGGER_2)
.alternateTypeRules(AlternateTypeRules.newRule(MyClass.class,
ImmutableMyClass.class));
https://springfox.github.io/springfox/docs/snapshot/#answers-to-common-questions-and-problems , see #22. It has side effects like resetting all custom settings.
Upvotes: 1