Comments (14)
Oups, I released only for maven.
I'll do the gradle release ASAP.
I'll notify you here.
from graphql-maven-plugin-project.
Hum,
Can you give some more information on your system:
- Are you using the client or the server part ? Or both ?
- If not both, what system is at the other side ? And what date/time format does it expect ?
- If you're using the client part of this plugin, can you set the log level to trace, and paste the request and response here ?
Etienne
from graphql-maven-plugin-project.
Hey Etienne, thank you for taking a look!
I'm using only the client side. The server side uses the following packages for it's graphql construction:
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-extended-scalars</artifactId>
The date/time format that it is expecting is the java object OffsetDateTime.
I will work on getting together a trace.
from graphql-maven-plugin-project.
BTW,
There are different ways to format a date.
A way is that you copy the com.graphql_java_generator.customscalars.GraphQLScalarTypeDateTime into a class of you own, and you adapt it according to your needs.
But the best way is probably that you also use the com.graphql-java:graphql-java-extended-scalars GraphQL implementation also on client side. Just use the graphql.scalars.ExtendedScalars.DateTime custom scalar.
Doing this should insure an homogeneous formatting.
Etienne
from graphql-maven-plugin-project.
@etienne-sf I'm running into the same problem (although with the Gradle plugin v1.12.1, but the code is the same if I'm not mistaken). I do have a custom scalar registered, however it is not being called for parameters directly in a query (not as bind parameters/variables). This is from the logging (slightly edited for brevity):
TRACE com.graphql_java_generator.client.QueryExecutorImpl: Executing GraphQL request: {"query":"query{graph(endDate:2021-03-09T10:32:16.511492995Z,startDate:2021-03-07T10:32:16.511446977Z){obj{uuid … __typename} x y __typename}}","variables":null,"operationName":null}
WARN notprivacysafe.graphql.GraphQL: Query failed to parse : 'query{graph(endDate:2021-03-09T10:32:16.511492995Z,startDate:2021-03-07T10:32:16.511446977Z){obj{uuid … __typename} x y __typename}}'
WARN my.package.resources.GraphQlResource: Errors: [InvalidSyntaxError{ message=Invalid Syntax : Invalid syntax: token recognition error at: '-03' at line 1 column 25 ,offendingToken=null ,locations=[SourceLocation{line=1, column=25}] ,sourcePreview=query{graph(endDate:2021-03-09T10:32:16.511492995Z,startDate:2021-03-07T10:32:16.511446977Z){obj{uuid … __typename} x y __typename}}}]
As you can see, the request is sent as:
query{graph(endDate:2021-03-09T10:32:16.511492995Z,startDate:2021-03-07T10:32:16.511446977Z){obj{uuid … __typename} x y __typename}}
whereas it should have been sent e.g. properly quoted as:
query{graph(endDate:"2021-03-09T10:32:16.511492995Z",startDate:"2021-03-07T10:32:16.511446977Z"){obj{uuid … __typename} x y __typename}}
from graphql-maven-plugin-project.
Digging somewhat deeper it appears to be because the generated code in the QueryExecutor has:
, InputParameter.newBindParameter("endDate","queryGraphEndDate", false, null)
, InputParameter.newBindParameter("startDate","queryGraphStartDate", false, null)
If I change that (manually) by replacing null
with my custom scalar instance:
, InputParameter.newBindParameter("endDate","queryGraphEndDate", false, DateTimeMapper.GraphQLDateTime)
, InputParameter.newBindParameter("startDate","queryGraphStartDate", false, DateTimeMapper.GraphQLDateTime)
it works correctly.
The question then becomes: how do I convince the generator to add the custom scalar instance here?
from graphql-maven-plugin-project.
You're right that the code is the same between the Maven and the Gradle versions.
When you say "_ I do have a custom scalar registered_", you mean that the Custom Scalar is registered in the build.gradle file, correct ?
The question then becomes: how do I convince the generator to add the custom scalar instance here?
This is an interesting way of asking the question
:)
And actually, the generator always write null, in this InputParameter.newBindParameter fifth parameter. Which is not really "convincing" for the generator.
I'll add a JUnit test, then a correction for this one.
Thanks for the detailed report.
Etienne
from graphql-maven-plugin-project.
When you say "_ I do have a custom scalar registered_", you mean that the Custom Scalar is registered in the build.gradle file, correct ?
Indeed. (It's actually for java.time.Instant
as that better semantics than java.util.Date
, but that's just a detail.)
This is an interesting way of asking the question
Polite as ever, me. 😉
Thanks for working on a fix! 👍
from graphql-maven-plugin-project.
[Side note: this appears to be related to #26 if I read things right.]
from graphql-maven-plugin-project.
Hello,
Can you check the 1.12.5 release ?
from graphql-maven-plugin-project.
Can you check the 1.12.5 release ?
@etienne-sf Is there a new release of the Gradle plugin? Else I need some assistance on how to use the Maven plugin in my Gradle project to test this.
from graphql-maven-plugin-project.
I just released the 1.12.5, for Gradle
from graphql-maven-plugin-project.
@etienne-sf Works like a charm, merci beaucoup!
from graphql-maven-plugin-project.
Thanks
:)
from graphql-maven-plugin-project.
Related Issues (20)
- Reserved field "null" not correctly parsed with the graphql-maven-plugin HOT 2
- Spring 6 - missing createError() method in OAuthTokenExtractor.GetOAuthTokenClientResponse implementing spring reactive ClientResponse HOT 7
- How to exclude DataFetchers/Controllers in 2.x HOT 6
- Documentation site gone? HOT 1
- Exception while generating Pojos HOT 2
- how bind graphQl respone with implement java class HOT 1
- Parse data even if responses contain errors HOT 8
- graphql-maven-plugin unable to create scalar for custom class HOT 4
- "code too large" compilation error HOT 8
- Missing break statements after VALUE_FALSE in deserialize method HOT 7
- queries on multiple endpoints on the same server HOT 2
- Filed to generate class based on enum HOT 4
- Vulnerable dependency maven:org.codehaus.plexus:plexus-utils:1.5.8 HOT 2
- Java method and params Naming conventions in @GraphQLRepository HOT 1
- Unable to parse variables in GraphQL HOT 14
- Client application fails with springContectBean instantiation error. HOT 1
- Abuse the JSON scalar HOT 4
- Declare plugin thread safe HOT 3
- Error with subscriptions returning enums HOT 3
- Add access token from camel context to the Default Webclient HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-maven-plugin-project.