Closed gjvoosten closed 1 year ago
Hello,
Thanks for the detailed analysis, and fix proposal.
If I undesrtand correctly, you're using the Base64String
custom scalar as an input parameter of a query (or mutation), and the exception is thrown when you execute this query.
Is this correct ?
Etienne
Correct; the error above happened when trying to send a mutation.
Hello,
This one has lots of internal impacts. Now solved. It will be available in the next release.
Would it be possible for you to test the correction before the release, by building the master branch ?
Etienne
Would it be possible for you to test the correction before the release, by building the master branch ?
I get test failures in graphql-java-client-runtime when trying to build latest master:
[ERROR] Failures:
[ERROR] GraphQLReactiveWebSocketHandlerTest.testEncode:60 expected: <{"post":{"topicId":"22","input":{"authorId":"12","date":"2021-03-13","publiclyAvailable":true,"title":"a title","content":"some content"}},"aCustomScalar":[["2021-04-01","2021-04-02"],["2021-04-03","2021-04-04"]],"aDate":"2021-10-11","anEnum":"ADMIN","anIntParam":666}> but was: <{"post":{"topicId":"22","input":{"authorId":"12","date":"2021-03-13","publiclyAvailable":true,"title":"a title","content":"some content"}},"aCustomScalar":[[1617228000000,1617314400000],[1617400800000,1617487200000]],"aDate":1633903200000,"anEnum":"ADMIN","anIntParam":666}>
[INFO]
[ERROR] Tests run: 195, Failures: 1, Errors: 0, Skipped: 7
Grrr It works for me. It's an issue with the date custom scalar serialization/deserialization. The dates appear to not been properly serialized.
What OS and java version are you using ?
BTW: you've 195 unit tests executed and one failure, which means that the base64 unit test is Ok. It would be better to have the whole build to be ok to also execute the base 64 IT tests, that run latter. But it's a first passed test.
I'm building on Fedora 37, and get the same test failure on a clean build using either Java 17, 11, or 1.8 (to get that last one to build I needed to comment out the <release>8</release>
on the main pom's maven-compiler-plugin, as JDK 1.8 doesn't recognise the --release 8
option).
I can do a mvn clean install -DskipTests
of course, but I need a build of the graphql-gradle-plugin installed to my local Maven repo and using these artifacts; what would I need to do for that?
Ok, I'll test with a Fedora 37. I'll need to setup an environment for that, so it will probably take some time.
About the
And yes, the mvn clean install -DskipTests
is not a good option: I'll test with the Fedora release and check that, before doing a new release.
I'm also using the packaged Maven, so:
$ mvn -v
Apache Maven 3.8.5 (Red Hat 3.8.5-3)
Thanks for taking the time to address this!
Hello,
I didn't install a Fedora box yet. But there may be an issue in the Date and DateTime custom scalar implementation provided by the plugin: it didn't force a Locale (as it seems useless for me here, but this remain IT... ;) ).
Is it possible for you to update your local git, and retry a build ?
As it happens I saw your commit and was already doing that. :wink: Unfortunately, the error is still there:
[INFO] Running com.graphql_java_generator.client.GraphQLReactiveWebSocketHandlerTest
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.01 s <<< FAILURE! - in com.graphql_java_generator.client.GraphQLReactiveWebSocketHandlerTest
[ERROR] com.graphql_java_generator.client.GraphQLReactiveWebSocketHandlerTest.testEncode Time elapsed: 0.007 s <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: <{"post":{"topicId":"22","input":{"authorId":"12","date":"2021-03-13","publiclyAvailable":true,"title":"a title","content":"some content"}},"aCustomScalar":[["2021-04-01","2021-04-02"],["2021-04-03","2021-04-04"]],"aDate":"2021-10-11","anEnum":"ADMIN","anIntParam":666}> but was: <{"post":{"topicId":"22","input":{"authorId":"12","date":"2021-03-13","publiclyAvailable":true,"title":"a title","content":"some content"}},"aCustomScalar":[[1617228000000,1617314400000],[1617400800000,1617487200000]],"aDate":1633903200000,"anEnum":"ADMIN","anIntParam":666}>
at com.graphql_java_generator.client.GraphQLReactiveWebSocketHandlerTest.testEncode(GraphQLReactiveWebSocketHandlerTest.java:60)
Ok, thank you for your very quick test.
I'll try it with a fedora box.
I could repeat the building error.
So I still released the 1.18.10 version.
I can confirm that this issue is indeed solved with release 1.18.10; thanks @etienne-sf !
I have a custom scalar configured like this:
However, when mutating an object with a
Byte[]
field, I get an exception:It appears that this check: https://github.com/graphql-java-generator/graphql-maven-plugin-project/blob/graphql-maven-plugin-project-1.18.9/graphql-java-client-runtime/src/main/java/com/graphql_java_generator/client/request/InputParameter.java#L768 is too early in the chain, and the custom scalar should take precedence. Naively changing the code like this:
fixes my problem (but please note that
graphQLScalarTypeParam
will then always benull
in the remainder of the if-then-else, so it probably needs a better fix).