我试图在我的springdoc 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(示例={ @ExampleObject( name = "Person sample",汇总= "person示例“,value =”test@gmail.Com“,”+ ""firstName":"josh",“+ ""lastName":”spring……“+ "}") })
我没那么过分-
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
有人能给我一个解决办法吗?
发布于 2022-03-31 12:33:21
这对我来说很管用
@Schema( type = "string", example = "Clark Kent")
private String name;
https://stackoverflow.com/questions/71661223
复制相似问题