Question: GraphQL support
Hey there, first of all I just want to say thank you for this project, it made getting Elide setup with Spring Boot a breeze!
I'll be honest, I'm a rookie to Java, Spring Boot, & Elide, so I'm figuring a lot of this out as I go. So far I've been successful at getting the JSON API working using this lib, but haven't been able to figure out how to go about enabling GraphQL. The Elide docs aren't very clear, other than to say it needs to be mounted to an endpoint like /graphql. It seems like that would be a good fit for the auto configuration this project is providing? Just curious if that's something being considered?
Thanks!
Unlike the Json API handle, the GraphQL handle requires Jersey library. However, so far it only supports spring 4 (To be honest, I haven’t used this library yet).
Therefore, I need maintain a modified version of GraphQLEndpoint. I must say that I'm not sure if this is the right way to integrate Elide with Spring. But you can try it with version 1.3.1-SNAPSHOT.
<dependency>
<groupId>org.illyasviel.elide</groupId>
<artifactId>elide-spring-boot-starter</artifactId>
<version>1.3.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yahoo.elide</groupId>
<artifactId>elide-graphql</artifactId>
<version>${elide.version}</version>
</dependency>
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
[1] There is a related issue about GraphQL Endpoint.
Thanks for the fast response! I appreciate the effort. Seems to work great so far.
I did encounter one issue with a LocalDateTime type on one of my fields, i.e.
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
Which would throw trying to build:
Caused by: java.lang.NullPointerException: null
at com.yahoo.elide.core.EntityBinding.getInheritedTypes(EntityBinding.java:436) ~[elide-core-4.2.3.jar:na]
at com.yahoo.elide.core.EntityBinding.<init>(EntityBinding.java:133) ~[elide-core-4.2.3.jar:na]
at com.yahoo.elide.graphql.NonEntityDictionary.bindEntity(NonEntityDictionary.java:42) ~[elide-graphql-4.2.3.jar:na]
at com.yahoo.elide.graphql.GraphQLConversionUtils.classToInputObject(GraphQLConversionUtils.java:386) ~[elide-graphql-4.2.3.jar:na]
at com.yahoo.elide.graphql.GraphQLConversionUtils.fetchScalarOrObjectInput(GraphQLConversionUtils.java:448) ~[elide-graphql-4.2.3.jar:na]
at com.yahoo.elide.graphql.GraphQLConversionUtils.attributeToInputObject(GraphQLConversionUtils.java:325) ~[elide-graphql-4.2.3.jar:na]
at com.yahoo.elide.graphql.GraphQLConversionUtils.classToInputObject(GraphQLConversionUtils.java:405) ~[elide-graphql-4.2.3.jar:na]
at com.yahoo.elide.graphql.GraphQLConversionUtils.fetchScalarOrObjectInput(GraphQLConversionUtils.java:448) ~[elide-graphql-4.2.3.jar:na]
at com.yahoo.elide.graphql.GraphQLConversionUtils.attributeToInputObject(GraphQLConversionUtils.java:325) ~[elide-graphql-4.2.3.jar:na]
at com.yahoo.elide.graphql.GraphQLConversionUtils.attributeToInputObject(GraphQLConversionUtils.java:260) ~[elide-graphql-4.2.3.jar:na]
at com.yahoo.elide.graphql.ModelBuilder.buildInputObjectStub(ModelBuilder.java:375) ~[elide-graphql-4.2.3.jar:na]
at com.yahoo.elide.core.EntityDictionary.walkEntityGraph(EntityDictionary.java:1059) ~[elide-core-4.2.3.jar:na]
at com.yahoo.elide.graphql.ModelBuilder.build(ModelBuilder.java:155) ~[elide-graphql-4.2.3.jar:na]
at org.illyasviel.elide.spring.boot.graphql.GraphQLHandle.<init>(GraphQLHandle.java:84) ~[elide-spring-boot-autoconfigure-1.3.1-SNAPSHOT.jar:na]
at org.illyasviel.elide.spring.boot.autoconfigure.ElideControllerAutoConfiguration$ElideGraphQLController.<init>(ElideControllerAutoConfiguration.java:201) ~[elide-spring-boot-autoconfigure-1.3.1-SNAPSHOT.jar:na]
at org.illyasviel.elide.spring.boot.autoconfigure.ElideControllerAutoConfiguration$ElideGraphQLController$$EnhancerBySpringCGLIB$$6884aedb.<init>(<generated>) ~[elide-spring-boot-autoconfigure-1.3.1-SNAPSHOT.jar:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_171]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_171]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_171]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_171]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:170) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
... 46 common frames omitted
But, I realized I've been trying to fight Elide on dates and it's easier just to stick with the Date type.
Looks like an Elide issue?
Yeah looks that way. You can close this issue as far as I'm concerned.