Skip to content

Custom operation filters #1025

Closed
Closed
@romash1408

Description

@romash1408

Is your feature request related to a problem? Please describe.
We have little library for api versioning that generates custom RequestCondition depending on special annotation. So we can write controllers like this:

@RestController
public class Controller {
    @Versioner(till = 0)
    @GetMapping("/test")
    public String old() {
        return "old";
    }

    @Versioner(from = 1)
    @GetMapping("/test")
    public Integer other() {
        return 123;
    }
}

Then GET /v0/test returns "old" and GET /v1/test returns 123

Now we need openapi to produce 2 groups: group v0 with GET /test endpoint that produces String and group v1 with GET /test endpoint that produces Integer

Describe the solution you'd like
Something like addCustomFilter in GroupedOpenApi.Builder where I can use handlerMethod.getMethodAnnotation(Versioner.class) to determine, if this method should be displayed in this group

Describe alternatives you've considered

  • I have tried to filter paths in OpenApiCustomiser, but when it is called, there is already only one endpoint because the others have been overwritten here due to identical operationPath (/test)

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