TommyLemon / APIAuto

☔ 敏捷开发最强大易用的接口工具,机器学习零代码测试、生成代码与静态检查、生成文档与光标悬浮注释,腾讯、华为、SHEIN、传音、工行等使用 ☔ The most advanced tool for HTTP API. Testing with machine learning, generating codes and static analysis, generating comments and floating hints. Used by Tencent, Huawei, SHEIN, TRANSSION, ICBC, etc.
http://apijson.cn/api
Apache License 2.0
1.96k stars 246 forks source link

【UnitAuto+APIJSON前后端本地部署问题】上传用例报错 POST请求,请在 内传 TestRecord:{} ! #38

Closed wwwjinlong closed 1 year ago

wwwjinlong commented 1 year ago

本地后端部署代码: 1、后端部署了APIJSONBoot6.0.0的代码 2、前端用的是UnitAuto-Admin 2.9.0最新的代码 3、sql执行的是6.0.0版本包里面的sql文件

POST http://localhost:8080/post Content-Type: application/json Cookie: Hm_lvt_965ec968d2d53b729b90efc7ffb3ead2=1682177888; Hm_lpvt_965ec968d2d53b729b90efc7ffb3ead2=1682178312; JSESSIONID=8A2C0C39A5D76046FC399A7D9AC962EB Host: apijson.cn:9090

{ "format":false, "Method":{ "userId":82001, "language":"Java", "package":"unitauto.test", "class":"TestUtil", "method":"plus", "this":null, "constructor":null, "classArgs":null, "genericClassArgs":null, "methodArgs":[ { "type":"Number", "value":97.66362 }, { "type":"Number", "value":93.2855 } ], "genericMethodArgs":[ { "type":"Number", "value":97.66362 }, { "type":"Number", "value":93.2855 } ], "type":"double", "genericType":"double", "static":1, "ui":0, "exceptions":null, "genericExceptions":null, "detail":"plus" }, "TestRecord":{ "randomId":0, "host":"unitauto.test.TestUtil.", "response":"" }, "tag":"Method" }

2023-04-23 01:05:01.455: AbstractVerifier.INFO: verifyRequest method = POST; name = ; target = {"Method":{"INSERT":{"@role":"OWNER"},"MUST":"method,class,package","REFUSE":"id"},"TestRecord":{"INSERT":{"@role":"OWNER"},"UPDATE":{"documentId@":"Method/id"},"MUST":"response","REFUSE":"id,documentId"}} request = {"Method":{"userId":82001,"language":"Java","package":"unitauto.test","class":"TestUtil","method":"plus","methodArgs":[{"type":"Number","value":97.66362},{"type":"Number","value":93.2855}],"genericMethodArgs":[{"type":"Number","value":97.66362},{"type":"Number","value":93.2855}],"type":"double","genericType":"double","static":1,"ui":0,"detail":"plus","@method":"POST"}} 2023-04-23 01:05:01.457: AbstractVerifier.INFO: verifyRequest method = POST; name = Method; target = {"INSERT":{"@role":"OWNER"},"MUST":"method,class,package","REFUSE":"id"} request = {"userId":82001,"language":"Java","package":"unitauto.test","class":"TestUtil","method":"plus","methodArgs":[{"type":"Number","value":97.66362},{"type":"Number","value":93.2855}],"genericMethodArgs":[{"type":"Number","value":97.66362},{"type":"Number","value":93.2855}],"type":"double","genericType":"double","static":1,"ui":0,"detail":"plus","@method":"POST"} 2023-04-23 01:05:01.457: AbstractVerifier.INFO: parse return real = {"userId":82001,"language":"Java","package":"unitauto.test","class":"TestUtil","method":"plus","methodArgs":[{"type":"Number","value":97.66362},{"type":"Number","value":93.2855}],"genericMethodArgs":[{"type":"Number","value":97.66362},{"type":"Number","value":93.2855}],"type":"double","genericType":"double","static":1,"ui":0,"detail":"plus","@method":"POST","@role":"OWNER"} java.lang.IllegalArgumentException: POST请求,请在 内传 TestRecord:{} ! at apijson.orm.AbstractVerifier$1.onParseJSONObject(AbstractVerifier.java:651) at apijson.orm.AbstractVerifier.parse(AbstractVerifier.java:964) at apijson.orm.AbstractVerifier.parse(AbstractVerifier.java:878) at apijson.orm.AbstractVerifier.verifyRequest(AbstractVerifier.java:643) at apijson.orm.AbstractVerifier.verifyRequest(AbstractVerifier.java:599) at apijson.orm.AbstractVerifier.verifyRequest(AbstractVerifier.java:548) at apijson.orm.AbstractParser.objectVerify(AbstractParser.java:2340) at apijson.orm.AbstractParser.batchVerify(AbstractParser.java:2243) at apijson.orm.AbstractParser.parseCorrectRequest(AbstractParser.java:574) at apijson.orm.AbstractParser.parseCorrectRequest(AbstractParser.java:882) at apijson.orm.AbstractParser.onVerifyContent(AbstractParser.java:525) at apijson.framework.APIJSONParser.onVerifyContent(APIJSONParser.java:180) at apijson.orm.AbstractParser.parseResponse(AbstractParser.java:418) at apijson.framework.APIJSONParser.parseResponse(APIJSONParser.java:117) at apijson.orm.AbstractParser.parseResponse(AbstractParser.java:391) at apijson.orm.AbstractParser.parse(AbstractParser.java:363) at apijson.framework.APIJSONController.parse(APIJSONController.java:93) at apijson.framework.APIJSONController.post(APIJSONController.java:175) at apijson.boot.DemoController.post(DemoController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) at javax.servlet.http.HttpServlet.service(HttpServlet.java:665) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:750) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:750)

TommyLemon commented 1 year ago

APIJSON 6.0.0 多表增删改有 bug,已修复但还没发新版。 目前建议使用 5.4.0 以下版本,另外 UnitAuto 用 2.8.1 及以下版本: https://github.com/TommyLemon/APIAuto/issues/26

或等发新版再用新版 APIJSON

TommyLemon commented 1 year ago

@wwwjinlong APIJSON 6.1.0 已发布,解决了多表同时增删改的 bug 等问题;新增支持 Snowflake,Databricks,Cassandra;增强条件组合、参数校验等: https://github.com/Tencent/APIJSON/releases/tag/6.1.0

相关 Demo https://github.com/APIJSON/APIJSON-Demo/tree/master/APIJSON-Java-Server/APIJSONBoot-MultiDataSource

wwwjinlong commented 1 year ago

6.1.0版本可以用,谢谢!!