0

我在我的 springboot 应用程序中使用 atlassian swagger 请求验证器。我尝试按照 [官方文档][1] [1] 中的说明配置所有 bean:https ://bitbucket.org/atlassian/swagger-request-validator/src/master/swagger-request-validator-springmvc/ . 但我收到以下错误

{

"status": 400,
"error": "Bad Request",
"message": "{\r\n  \"messages\" : [ {\r\n    \"key\" : \"validation.request.body.schema.unknownError\",\r\n    \"level\" : \"ERROR\",\r\n    \"message\" : \"An error occurred during schema validation - null.\",\r\n    \"context\" : {\r\n      \"requestPath\" : \"/mybook/mypage/12345/rules/\",\r\n      \"apiRequestContentType\" : \"application/json\",\r\n      \"location\" : \"REQUEST\",\r\n      \"requestMethod\" : \"POST\"\r\n    }\r\n  } ]\r\n}",
"trace": "com.atlassian.oai.validator.springmvc.InvalidRequestException: {\r\n  \"messages\" : [ {\r\n    \"key\" : \"validation.request.body.schema.unknownError\",\r\n    \"level\" : \"ERROR\",\r\n    \"message\" : \"An error occurred during schema validation - null.\",\r\n    \"context\" : {\r\n      \"requestPath\" : \"/mybook/mypage/12345/rules/\",\r\n      \"apiRequestContentType\" : \"application/json\",\r\n      \"location\" : \"REQUEST\",\r\n      \"requestMethod\" : \"POST\"\r\n    }\r\n  } ]\r\n}\r\n\tat com.atlassian.oai.validator.springmvc.DefaultValidationReportHandler.createValidationException(DefaultValidationReportHandler.java:96)\r\n\tat com.atlassian.oai.validator.springmvc.DefaultValidationReportHandler.processApiValidationReport(DefaultValidationReportHandler.java:63)\r\n\tat com.atlassian.oai.validator.springmvc.DefaultValidationReportHandler.handleRequestReport(DefaultValidationReportHandler.java:49)\r\n\tat com.atlassian.oai.validator.springmvc.OpenApiValidationInterceptor.preHandle(OpenApiValidationInterceptor.java:96)\r\n\tat org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:136)\r\n\tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1033)\r\n\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)\r\n\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)\r\n\tat org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:660)\r\n\tat org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)\r\n\tat 

解决此问题的任何指示都会有所帮助

4

1 回答 1

0

我相信问题出在最新版本上。我使用了 2.7x 并且工作正常

于 2020-01-25T18:08:42.340 回答