Quarkus:无法为MicroProfile apiresponses创建自定义注释 - 错误 - @@apiresponses'不适用于注释类型
Quarkus,带有微型露天和招摇。 我们正在尝试为@apirespons创建自定义注释。 这可能在Quarkus中吗?
`org.eclipse.microprofile.openapi.annotations.APIResponses;` `package org.eclipse.microprofile.openapi.annotations.*;` `@Target({ElementType.METHOD, ElementType.TYPE, ElementType.ANNOTATION_TYPE})` `@Inherited` `@Documented` `@Retention(RetentionPolicy.RUNTIME)` `@Target(ElementType.TYPE)` `@ApplicationScoped` `@APIResponses(value = {` `@APIResponse(responseCode = "200", description = ".."),` `@APIResponse(responseCode = "201", description = "..") ,` `@APIResponse(responseCode = "202", description = "..") }` `)` `public @interface customApiResponse {` `}`
Quarkus with microprofile openapi and swagger.
We are trying to create custom annotation for @APIResponses.
Is this possible in quarkus?
`org.eclipse.microprofile.openapi.annotations.APIResponses;` `package org.eclipse.microprofile.openapi.annotations.*;` `@Target({ElementType.METHOD, ElementType.TYPE, ElementType.ANNOTATION_TYPE})` `@Inherited` `@Documented` `@Retention(RetentionPolicy.RUNTIME)` `@Target(ElementType.TYPE)` `@ApplicationScoped` `@APIResponses(value = {` `@APIResponse(responseCode = "200", description = ".."),` `@APIResponse(responseCode = "201", description = "..") ,` `@APIResponse(responseCode = "202", description = "..") }` `)` `public @interface customApiResponse {` `}`
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是在夸克(Quarkus)中可能存在的问题,而是微型露天的可能性。
apiresponses
注释的目标定义为@target({emementType.method})
,因此您不能在类型上使用它,仅在方法上。将问题提高到微填充openapi项目可能是一个好主意,以解释您要做什么以及为什么要做什么,并查看是否应该更改某些东西。然后,它自然会在Quarkus中结束。
It is not a question of being possible in Quarkus but more possible with MicroProfile OpenAPI.
The
ApiResponses
annotation has a target defined to@Target({ ElementType.METHOD })
so you cannot use it on a type, only on methods.Probably a good idea to raise the issue to the MicroProfile OpenAPI project explaining what you want to do and why and see if something should be changed. Then it will naturally end up in Quarkus.