我已经使用 springboot 创建了rest webservice,并添加了 springdoc-open-api 用于 webservice 的文档,现在我有 2 个问题
1-如何将自定义测试值添加到显示在swagger-ui文档页面上的请求中?
2-如何在 swagger-ui 文档页面上单击“TRY IT OUT”按钮来执行请求?
请参考下面的代码片段来获取其余的网络服务:
@PostMapping(value="/result", consumes={ "application/json"},produces={ "application/json" } )
@Parameter(description = "Student object need to calculate the score" ,name="InputObject", required = true )
public ResponseEntity<Result> displayResult(@Valid @RequestBody Student request);
Public class Student{
String name;
String birthDate;
String motherName;
int rollNo;
int seatNo;
}
Public class Result{
int marks;
String grade;
double percentage;
}
I have tried to add value of request using @Schema(name = "name", example= …Run Code Online (Sandbox Code Playgroud)