Skip to content

Enhancement Request: Direct Support for @ModelAttribute in springdoc-openapi without @ParameterObject Annotation #2439

@wangxing-git

Description

@wangxing-git

Describe the enhancement

When using @ModelAttribute in a Spring MVC controller, it currently requires additional usage of @ParameterObject from springdoc-openapi to generate accurate documentation. An enhancement is requested to provide direct support for @ModelAttribute without the need for additional @ParameterObject annotation, reducing annotation complexity.

To Reproduce
Steps to reproduce the current behavior:

  • Spring Boot version: 3.2.0
  • springdoc-openapi version: 2.2.0
@RestController
public class TestController {

    @GetMapping("/springdoc/test")
    public void test(@ParameterObject @ModelAttribute TestRequest request){
    }

    @Data
    static class TestRequest {

        /**
         * aa
         */
        private String a;

    }
}

Expected behavior

Direct support for @ModelAttribute in the Spring MVC controller without the need for additional @ParameterObject annotation.

Additional context
Add any other context about the feature enhancement here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions