dromara / forest

A high-level and lightweight declarative HTTP client framework for Java. it makes sending HTTP requests in Java easier.
MIT License
1.72k stars 218 forks source link

JSONBody 序列化错误 #214

Open PeterFangXiaoLin opened 1 week ago

PeterFangXiaoLin commented 1 week ago

接口代码:

    @Post("/addProject.do")
    ProjectRespVO addProject(@JSONBody ProjectAddReqVO projectAddReqVO);

ProjectAddReqVO

import cn.com.huaruan.hrcodeframe.allplatform.thirdapi.vo.user.UserVO;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;

@Data
@Builder
public class ProjectAddReqVO implements Serializable {
    // 项目名称
    private String projectName;

    // 项目编号
    private String projectCode;

    // 项目日期  格式:YYYY-MM-DD
    // @JsonProperty("pDate")
    private LocalDate pDate;

    // 建设单位
    private String jsdw;

    // 分院ID 默认-1
    private Integer branchDeptId; // 分院ID,默认-1

    // 项目负责部门ID(可选)
    private String pmpDeptId;

    // 项目负责人
    private List<UserVO> pmpUser;
    // 项目注册负责人
    private List<UserVO> zcUser;
}

结果

Headers: 
        User-Agent: forest/1.5.36
        Content-Type: application/json
    Body: {"PDate":"2024-11-20","branchDeptId":-1,"jsdw":"测试","pmpUser":[{"userId":"123","userName":"测试"}],"projectCode":"测试","projectName":"测试项目","zcUser":[{"userId":"123","userName":"测试"}]}

经过测试,只要是一个字母的驼峰转换,最后都会变成大写,例如 pHello -> PHello

这是BUG吗?

witt-bit commented 1 week ago

这个lombok的问题,具体查询lombok相关,lombok对于单个字母的gettersetter与jackson处理不一致