【问题标题】:Micronaut does not generate OpenAPI YAML with query parametersMicronaut 不生成带有查询参数的 OpenAPI YAML
【发布时间】:2019-01-16 16:23:55
【问题描述】:

运行最新版本的 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";
    }
}

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

【问题讨论】:

    标签: swagger openapi micronaut


    【解决方案1】:

    好的,虽然我希望抑制 @Parameter 应该起作用,但我设法使它起作用添加 in=ParameterIn.QUERY

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-29
      • 2021-06-02
      • 2020-10-18
      • 1970-01-01
      • 2019-03-24
      相关资源
      最近更新 更多