Swagger Micronaut:生成到请求主体中的身份验证主体

Swagger Micronaut:生成到请求主体中的身份验证主体,swagger,openapi,micronaut,Swagger,Openapi,Micronaut,我正在尝试从Micronaut服务器生成带有swagger codegen的客户端代码。问题出现在经过身份验证的POST和PUT路由上(对于获取删除,它工作得很好) 当我在控制器中有这样的方法时: @Override @Post("/") public Single<? extends HttpResponse> updateStatus(Authentication authentication, GameReference gameReference) { // ...

我正在尝试从Micronaut服务器生成带有swagger codegen的客户端代码。问题出现在经过身份验证的POST和PUT路由上(对于获取删除,它工作得很好)

当我在控制器中有这样的方法时:

@Override
@Post("/")
public Single<? extends HttpResponse> updateStatus(Authentication authentication, GameReference gameReference) {
    // ...
}
因此,身份验证主体已内置到请求主体中,并且在生成的客户端代码中,该方法的参数将是一个具有身份验证和GameReference的对象

我试图解决这个问题的方法:

  • 在身份验证参数之前添加@Parameter(hidden=true)。没有更改任何内容。
  • 使用虚张声势注释进行身份验证,如@SecuritySchema和@SecurityDefention。身份验证原则仍然会生成到swagger yaml中

这是Micronauts Swagger实现中的一个bug,还是有办法解决这个问题?请注意,这对于GET和DELETE很有效。认证原则被忽略。

Micronaut团队将其视为缺陷:

打开了Micronaut的一个问题:
post:
  tags:
  - /presence
  description: Updates status
  operationId: updateStatus
  parameters: []
  requestBody:
    content:
      application/json:
        schema:
          type: object
          properties:
            authentication:
              $ref: '#/components/schemas/Authentication'
            gameReference:
              $ref: '#/components/schemas/GameReference'
    required: true
  responses:
    default:
      description: HTTP 204 for successful updates.
      content:
        application/json: {}