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 {`
`}`
1

There are 1 best solutions below

3
On

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.