嵌套java swagger@operation config

egdjgwm8  于 2021-07-03  发布在  Java
关注(0)|答案(0)|浏览(302)

通过swagger annotations v2.1.5 dependency,我尝试构建以下内容:

  1. "x-amazon-apigateway-integration":{
  2. "type":"http",
  3. "httpMethod":"GET",
  4. "uri":"http://<DOMAIN>/api/hello-world",
  5. "responses":{
  6. "default":{
  7. "statusCode":200
  8. }
  9. }
  10. }

下面的java代码生成上面的json,除了“responses”树。有人能建议如何在下面的java代码中添加它吗:

  1. @Operation(extensions = {
  2. @io.swagger.v3.oas.annotations.extensions.Extension(name = "x-amazon-apigateway-integration", properties = {
  3. @io.swagger.v3.oas.annotations.extensions.ExtensionProperty(name = "type", value = "http"),
  4. @io.swagger.v3.oas.annotations.extensions.ExtensionProperty(name = "httpMethod", value = "GET"),
  5. @io.swagger.v3.oas.annotations.extensions.ExtensionProperty(name = "uri", value = "http://<DOMAIN>/api/hello-world")
  6. })
  7. })
  8. @GetMapping(value = "/hello-world")
  9. public ResponseEntity<?> helloWorld() {
  10. return ResponseEntity.ok("Hello World");
  11. }

pom.xml具有以下3个依赖项:

  1. <dependency>
  2. <groupId>io.springfox</groupId>
  3. <artifactId>springfox-swagger2</artifactId>
  4. <version>3.0.0</version>
  5. </dependency>
  6. <dependency>
  7. <groupId>io.springfox</groupId>
  8. <artifactId>springfox-swagger-ui</artifactId>
  9. <version>3.0.0</version>
  10. </dependency>
  11. <dependency>
  12. <groupId>io.swagger.core.v3</groupId>
  13. <artifactId>swagger-annotations</artifactId>
  14. <version>2.1.5</version>
  15. </dependency>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题