我有一个带有@RequestBodyDTO 的控制器。我需要显示 DTO 的架构,而不是stringSwagger 中 RequestBody 架构中的默认架构。
通过在 API 之上使用 @Operation 并在其中使用 @Parameter,我已经能够在两个地方描述 DTO

并填写示例(参见代码)。我已经尝试@Schema过@Operation(在 requestBody 下)和@Parameter注释。前者抛出 NPE,后者不做任何改变,并针对 DTO 本身中的对应注释进行了各种尝试。
样品控制器
@RequestMapping(value = "/{myPathVar}", method = RequestMethod.POST)
@Operation(summary = "Create something.",
parameters = { @Parameter(in = ParameterIn.PATH, name = "myPathVar", description = "Some path variable. Swagger uses this description.") },
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "My description here.",
content = @Content(examples = @ExampleObject("{\"A\" : \"a\",\"B\" : \"{\"b\" : \"foo\", \"bb\" …Run Code Online (Sandbox Code Playgroud)