Skip to content

Some issues when upgrade to SpringDoc 2.7 #2984

Closed
@cd4ever

Description

@cd4ever

Recently I ran into some issues when upgrade to SpringBoot 3.4.5 and SpringDoc 2.7.

Here is maven dependencies of my project,

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>3.4.5</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>

		<dependency>
			<groupId>org.springdoc</groupId>
			<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
			<version>2.7.0</version>
		</dependency>
I have one controller method like this, 
    @Operation(summary = "get user list")
    @GetMapping(value = "")
    public CommonResult<CommonPage<UmsUser>> list(UmsUserQueryParam queryParam,
                                                  @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
                                                  @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
    ...
   }

And here is the definition of UmsUserQueryParam,

@Data
@Accessors(chain = true)
public class UmsUserQueryParam {
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "userId")
    private Long userId;

    @Schema(name = "username")
    private String username;

    @Schema(name = "email")
    private String email;

    @Schema(name = "mobile")
    private String mobile;

}

When I go to the swagger page,

Image

You see the queryParam is rendered as "object", not split UmsUserQueryParam object into individual properties like what I see in previous version of swagger page.

In that project, there is also a similar controller method and one query class,

@Data
@Accessors(chain = true)
public class UserQueryParam {
    @ApiModelProperty(value = "user id")
    private Long userId;

    @ApiModelProperty(value = "user name")
    private String username;

    @ApiModelProperty(value = "email")
    private String email;

    @ApiModelProperty(value = "mobile")
    private String mobile;

    @ApiModelProperty(value = "enable status")
    private Integer enableStatus;

    @ApiModelProperty(value = "department id")
    private Long deptId;

    @ApiModelProperty(value = "domain id")
    private Long domainId;

    @ApiModelProperty(value = "role id")
    private Long roleId;
}

It look like below, every property is rendered individually,
Image

What's more, there is another Long type precision loss issue. When I input the value of userId like below,

Image

It actually invoke backend API with some precision loss like below. I input 1917147886395588608, but it passes 1917147886395588600
Image

So can anyone give me some prompt on above two issues?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions