Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Validation 请求参数和自定义错误消息的招摇过市验证_Validation_Http_Spring Boot_Swagger - Fatal编程技术网

Validation 请求参数和自定义错误消息的招摇过市验证

Validation 请求参数和自定义错误消息的招摇过市验证,validation,http,spring-boot,swagger,Validation,Http,Spring Boot,Swagger,我需要关于spring boot的招摇验证的帮助 在Req1中,它没有显示字段名,您能帮我吗?另外,如何为任何验证提供自定义错误消息 更新: 在req1的响应中,没有在消息中显示字段名(productCode),但在req2的响应中,我们可以看到字段名 type: object description: get details request object required: [productCode] properties: productCode:

我需要关于spring boot的招摇验证的帮助


在Req1中,它没有显示字段名,您能帮我吗?另外,如何为任何验证提供自定义错误消息

更新: 在req1的响应中,没有在消息中显示字段名(
productCode
),但在req2的响应中,我们可以看到字段名

type: object
    description: get details request object
    required: [productCode]
    properties:
      productCode:
        type: string
        minLength: 1
        description: Identifier for application 
--需求1-----

--Res1-----

--需求2-----

--Res2-----


“它没有显示字段名”-没有显示它的确切位置?在调试器中,在API文档中,在其他地方?谢谢回复。我更新了问题,请检查。
{
"productCode":""
}
{
   "code": "400",
   "status": 400,
   "message": "Validation Failed: string \"\" is too short (length: 0, required minimum: 1)"
}
{  }
{
   "code": "400",
   "status": 400,
   "message": "Validation Failed: object has missing required properties ([\"productCode\"])"
}