Rab*_*lck 7 java swagger spring-boot openapi springdoc-openapi-ui
我正在尝试将示例响应值添加到我的 springdoc-openapi swagger 文档中。
比如用“马克·吐温”替换“字符串”等。
我尝试使用此解决方案 - springdoc-openapi: How to add example of POST request?
我已经org.springframework.web.bind.annotation.RequestBody在我的课堂上使用了。
如果我用这个 -
@io.swagger.v3.oas.annotations.parameters.RequestBody(content = @Content(examples = {
@ExampleObject(
name = "Person sample",
summary = "person example",
value =
"{\"email\": test@gmail.Com,"
+ "\"firstName\": \"josh\","
+ "\"lastName\": \"spring...\""
+ "}")
}))
Run Code Online (Sandbox Code Playgroud)
我得到以下解释 -
no viable alternative at input ',@io.swagger.v3.oas.annotations.parameters.RequestBody(content=@Content(examples={@ExampleObject(name="Person sample",summary="person example",value="{\"email\": test@gmail.Com,"+"\"firstName\": \"josh\","+"\"lastName\": \"spring...\""+"}")})))': NoViableAltException```
Can anyone give me a solution please?
Run Code Online (Sandbox Code Playgroud)
Rab*_*lck 10
这对我有用
@Schema( type = "string", example = "Clark Kent")
private String name;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6410 次 |
| 最近记录: |