SpringForAll / spring-boot-starter-swagger

自制spring boot starter for swagger 2.x,来试试吧,很好用哦~
Apache License 2.0
2.13k stars 523 forks source link

加入swagger 并且加入校验器之后,对应的接收对象就变成了json的了,有什么好的方式进行解决 #47

Open egzosn opened 6 years ago

dyc87112 commented 6 years ago

不好意思,没有get到问题点。。。

egzosn commented 6 years ago

在参数没有加上@Valid的时候是这样的 3

/**
 * @author egan
 * @email egzosn@gmail.com
 * @date 2018/2/8
 */
@RequestMapping("swg")
@RestController
public class SwgTest extends BaseController{
    @ApiOperation(value = "测试Swg")
    @RequestMapping(value = "test", method = RequestMethod.POST)
    public Map<String, Object> test( SwgBean body){
        return successData();
    }
}

然后加上之后变成这样了 1

/**
 * @author egan
 * @email egzosn@gmail.com
 * @date 2018/2/8
 */
@RequestMapping("swg")
@RestController
public class SwgTest extends BaseController{
    @ApiOperation(value = "测试Swg")
    @RequestMapping(value = "test", method = RequestMethod.POST)
    public Map<String, Object> test(@Valid SwgBean body){
        return successData();
    }
}
dyc87112 commented 6 years ago

试一下:@RequestParam @Valid SwgBean body