@Tag OpenAPI annotation on Resource producer method

117 Views Asked by At

I am using Quarkus 3.2 with quarkus-smallrye-openapi extension. I would like to place @Tag annotations from Microprofile OpenAPI on JAX-RS resource producer methods:

@Path("/search")
public class SearchResource {

  @Path("profile1")
  @Tag(name="Profile 1 Resource", description="Search Profile 1")
  public SearchResource searchProfile1() {
    return new SearchResource(profile1Config);
  }

  @Path("profile2")
  @Tag(name="Profile 2 Resource", description="Search Profile 2")
  public SearchResource searchProfile2() {
    return new SearchResource(profile2Config);
  }

SearchResource is JAX-RS resource class containing several operations.

The generated OpenAPI contracts contains:

paths:
  /search/profile1/summary:
    get:
      tags:
      - Search Resource
  /search/profile1/detail:
    get:
      tags:
      - Search Resource
  /search/profile2/summary:
    get:
      tags:
      - Search Resource
  /search/profile2/detail:
    get:
      tags:
      - Search Resource

These @Tag annotations are

  • OK when placed at Resource class level
  • OK when placed at Operation method level (a method returning content)
  • Not OK when placed at Sub-resource producer method level (a method returning a sub-resource)

Is it possible to make the last case work?

0

There are 0 best solutions below