Skip to content

Annotations on concrete class/methods are ignored #619

Open
@rohitsanj

Description

@rohitsanj

Hi! I'm trying to add microprofile openapi annotations to an implementation class (and it's @Override methods), with the intention for these annotations being added to the existing set of annotations on the underlying interface. However, these annotations are ignored and do not get picked up in the OpenAPI spec.

I'm not sure if this is a limitation of the Java language itself, or if it's something this library does not support, or if it's a bug! I've described in detail what I'm trying to accomplish below:

Consider this Java interface that declares some route handlers (I guess Quarkus/microprofile does some magic to generate the OpenAPI spec from these annotations)

import jakarta.ws.rs.*;
import jakarta.ws.rs.core.Response;

@Path("/foo/bar")
public interface FooResource {
  @GET
  Response getBar();
}

Concrete implementation of the interface above,

import org.eclipse.microprofile.openapi.annotations.enums.ParameterIn;
import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
import org.eclipse.microprofile.openapi.annotations.tags.Tag;

@Tag(name = "Foo Resource") // ignored
public class FooResourceImpl implements FooResource {
  @Parameter(name = "x-connection-id", in = ParameterIn.HEADER, required = true) // ignored
  @Override
  public Response getBar() {
    // bla
  }
}

For more context about the project I'm currently working on: since the resource interfaces are generated from an OpenAPI spec, it's not straightforward to simply add the openapi annotations onto the interface directly.

Hoping to engage the community here to find a path forward, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions