Micronaut不会使用查询参数生成OpenAPI YAML

时间:2019-01-16 16:23:55

标签: swagger openapi micronaut

运行Micronaut(1.0.3)的最新版本并包含Swagger依赖项会生成OpenAPI YAML文件。但是,即使提供Swagger的@Parameter,它也不包含查询字符串的参数。

package hello;

import io.micronaut.http.annotation.Get;
import io.swagger.v3.oas.annotations.Parameter;

@io.micronaut.http.annotation.Controller
public class Controller {   
    @Get(uri = "/hello")
    public String hello(@Parameter(name = "name",
                description = "Name of person to greeted") String name) {
        return "Hello World";
    }
}

这是错误还是我忘记了什么?

1 个答案:

答案 0 :(得分:0)

好的,尽管我希望抑制@Parameter应该起作用,但是我设法使它在添加in=ParameterIn.QUERY的情况下起作用。

此外,也可以使用@QueryValue查看Micronaut的源代码。