嵌套java swagger@operation config

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

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

"x-amazon-apigateway-integration":{
    "type":"http",
    "httpMethod":"GET",
    "uri":"http://<DOMAIN>/api/hello-world",
    "responses":{
        "default":{
            "statusCode":200
        }
    }
}

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

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

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

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>3.0.0</version>
</dependency>
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>3.0.0</version>
</dependency>
<dependency>
    <groupId>io.swagger.core.v3</groupId>
    <artifactId>swagger-annotations</artifactId>
    <version>2.1.5</version>
</dependency>

暂无答案!

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

相关问题