Skip to content

The fields of the @ParameterObject marked object are required. #541

Closed
@wangyanrui

Description

@wangyanrui

version: 1.3.1

All fields are required when an object is used as an input parameter who marked @ParameterObject

eg:

    @GetMapping(value = "/demo")
    public Result<?> list(@ParameterObject ParameterQuery query,
                          @ParameterObject @PageableDefault Pageable pageable) {
        return ResultCreator.success(null);
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class ParameterQuery implements Serializable {
        private String q1;
        private String q2;
        private String q3;
    }

And It is still invalid If I mark @parameter(required = false) on the field like this

    @Parameter(required = false)
    private String q1;

图片

I read the source code, probably because of a problem with these two lines of code or the way I use it ?

org.springdoc.core.AbstractRequestBuilder row 352
org.springdoc.core.GenericParameterBuilder row 159

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