我正在尝试从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: {}
因此,身份验证主体已内置在请求主体中,并且在生成的客户端代码中,该方法的参数将是同时具有身份验证和GameReference的对象。
我试图解决此问题的方法:
这是Micronauts Swagger实现中的错误还是有解决此问题的方法?请注意,这对于GET和DELETE效果很好。在那里,身份验证原理被忽略。
答案 0 :(得分:0)
它被Micronaut团队视为错误: https://github.com/micronaut-projects/micronaut-core/issues/1155