-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON Javascript object with string array as member are passed empty when invoking java object from javascript #2234
Comments
@arnault01 before I look at this, can you do a quick test with 1.4.0.RC2 ? Graal had a problem with JSON marshalling |
1.4.0 requires Java 11: #2083 (comment) |
Hi Peter, thaks for taking a look at this issue.
|
@arnault01 sorry for the quick negative response, but I'm deeming this sample as "too complicated". I am unable to trace the flow of what is doing what. by the way one reason I'm giving up is we spent a lot of time ironing out similar bugs when replacing the JS engine. it was not easy, and we kept releasing RC versions to get feedback from the community. now we have moved on, and you are a little late to the scene with a 0.9.X migration Karate has pretty good built in routines for json conversions and even java bean conversion, so I'm confident you will be able to avoid depending on any external stuff if you really try one hint in case it helps: the new JS engine is a little picky, so for best results - convert things to JSON strings when trying to "interop" with Java code, in case the Map and List approach does not work. and lastly, when you are within a JS function and then call to Java code, you may have to call all the best ! happy to look again if you succeed in boiling down the repro to 2 files and a few lines of code. we are trying to fix one pending possibly related issue: #2232 |
@arnault01 we think we identified the problem. 1.4.0.RC3 has been released, please try it and let us know |
Hi @ptrthomas I just tried this morning with the new version 1.4.0.RC3 with no success, it does not solve the issue. Btw I'm aware that karate-apache is no more required for newer version of the engine, it was added only in the case where the sample project was modified to run with the karate engine 0.9.6 in order to make it work chaning the simple pom.xml property karate.version. |
@arnault01 thanks for the update, yes please do submit a simpler example and I will look at it. I'm pretty sure that it is the XML annotations on your side. so if you can eliminate that from your sample I would highly prefer that. do consider my hints on passing "plain old JSON" to karate to avoid any marshalling / unmarshalling weirdness |
Hi @ptrthomas, I've submitted a simpler example, have you had a chance to look at it ? |
@arnault01 not yet, I'll try over the weekend |
I have a test case failing with 1.3.1 karate engine and succeeding with engine 0.9.6
In load-config.js we define a JSON object:
Which is used to instantiate some Java object with fasterxml JSON annotations.
also
The end result is that the string array is empty when received in the java implementation (println of the parmaters attest that).
I have attached a reproduceable test case with all the source code, after following the note about how to submit an issue.
You can play with the pom.xml property karate.version in the maven file from 1.3.1 to 0.9.6.
myproject.zip
The text was updated successfully, but these errors were encountered: