Skip to content

Inherited Methods Not Included in Swagger Documentation with @RouterOperation in Spring Boot WebFlux Application #2525

Closed
@oms12

Description

@oms12

Describe the bug

When using @RouterOperation to document API endpoints in Spring Boot Webflux applications with springdoc-openapi, the Swagger does not include methods inherited from parent classes. This occurs because internally, AopUtils.getTargetClass(handlerBean).getDeclaredMethods() is used, which only retrieves declared methods, not methods from parent classes.

Because suppose there is a method already implemented in parent class and I don't want to implement that method again in child class and the method implemented in the parentClass is my beanMethod.
Since that method is already inherited by the child class it should be child class function also.

To Reproduce

  1. Specify @RouterOperation for an endpoint in a Spring Boot application.
  2. Define a method in a subclass that overrides a method from a parent class and parent class method is the beanMethod.
  3. Check the generated Swagger documentation.

Spring Boot version: 3
springdoc-openapi module version:

        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
            <version>2.3.0</version>
        </dependency>

Expected behavior

Swagger documentation should include methods inherited from parent classes when using @RouterOperation.

Screenshots
image

Additional context
Code where beanClass and beanMethod is used.
@RouterOperation(path = "v1/payment", method = RequestMethod.POST, beanClass = PaymentHandler.class, beanMethod = "handle", operation = @Operation(description = "Say hello GET", operationId = "lowercaseGET", tags = "persons"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    incompleteincomplete description: Make sure you Provide a Minimal, Reproducible Example - with HelloController

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions