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

Micronaut: Authentication Principal generated into request body

我正在尝试从 Micronaut 服务器使用 swagger-codegen 生成客户端代码。问题出现在经过身份验证的 POST 和 PUT 路由(它适用于 GET 一个 DELETE)。

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

@Override
@Post("/")
public Single<? extends HttpResponse> updateStatus(Authentication authentication, GameReference gameReference) {
    // ...
}

该方法的结果如下所示:

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: {}

因此,Authentication Principal 已内置到请求正文中,在生成的客户端代码中,该方法的参数将是一个同时具有 Authentication 和 GameReference 的对象。

我尝试解决此问题的方法:

这是 Micronauts Swagger 实施中的一个错误,还是有办法解决这个问题?请注意,这适用于 GET 和 DELETE。那里忽略了身份验证原则。

它被 Micronaut 团队接受为一个错误: https://github.com/micronaut-projects/micronaut-core/issues/1155