Skip to content

Enhance Operation Scanning Mechanism #1020

Closed
@azige

Description

@azige

Is your feature request related to a problem? Please describe.

I installed the library and configure methods in a @Controller with @Operation. I was confused that some of my @Controller methods get picked and included in OpenAPI model, but others are not.

Later I learned the library is aimed to @RestController. @Controller should be configured through SpringDocUtils.getConfig().addRestControllers to be exposed.

But for version 1.5.2, any method with @ResponseBody in @Controller will be "leaked" to the OpenAPI model even that user does not configure SpringDocUtils.getConfig().addRestControllers.


Describe the solution you'd like

There are two ways.

1. Pick every @Operation in @Controller

Any @Operation should be picked no matter in @RestController or @Controller. Users expect a method get picked if they annotate @Operation on it. I think it makes more sense this way.

The problem is it may break the library's original purpose.

2. Strictly pick methods in @RestController only

this solution is dropped.

It means, any methods in @Controller won't be picked unless explicitly configured SpringDocUtils.getConfig().addRestControllers. Users won't get confused if their entire @Controller is missing from OpenAPI model and will search the document to find how to expose it.

The problem is it may cause compatibility issues.


The solution 1 is preferred. This test set should be passed later after new version released.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions