These are chat archives for graphql-java/graphql-java

9th
Jun 2017
Jason Shi
@shishuwu
Jun 09 2017 03:15
Any samples that covers all features of graphql-java/graphql-java 3.0.0. (The tests/samples insides it is related too ambiguous and not intutive)
Brad Baker
@bbakerman
Jun 09 2017 04:11
@shishuwu - what are you after? if you want to know about graphql in general, I recommend some of the online tools
or if you are after specific -how to - in java”?
Andreas Marek
@andimarek
Jun 09 2017 05:14
@shishuwu here is a demo project, but it is not finished yet: https://github.com/andimarek/graphql-java-demo
it is built on top of graphql-java 3.0.0, but it doesn't cover all features
Jason Shi
@shishuwu
Jun 09 2017 05:20
@bbakerman yes, it is specific"how to java"
@andimarek thank you
Jason Shi
@shishuwu
Jun 09 2017 08:06
I define a directive @volatile to annote a field, but it looks not work (cannot find this annotation in the instance) in my graphql-java project, any place not right? thanks
# directive
directive @volatile on FIELD_DEFINITION

# schema

schema {
    query: Query
    mutation: Mutation
}

type Query {
    posts: [Post] @volatile
    author(id: Int!): Author
}
Bojan Tomić
@kaqqao
Jun 09 2017 09:15
@shishuwu You raise an interesting question...
@andimarek @bbakerman Are custom directives even supported? I see no way of registering a directive definition with the schema...
Bojan Tomić
@kaqqao
Jun 09 2017 09:59

#183 (for example) is mentioning directive support, but GraphQLSchema#getDirectives says

return Arrays.asList(Directives.IncludeDirective, Directives.SkipDirective);

so only the predefined list of known directives

Andreas Marek
@andimarek
Jun 09 2017 10:05
@kaqqao @shishuwu custom directives are only supported at schema definition, but not for queries. the directive you added should be accessible via the FieldDefintion for Query. But behind that there is no support in any way: it is not checked or interpreted.
Bojan Tomić
@kaqqao
Jun 09 2017 10:18
@andimarek Is there a way to register a directive manually i.e. not by generating from IDL?
I'd expect a method like GraphQLSchema.Builder#directive(GraphQLDirective) or similar
Bojan Tomić
@kaqqao
Jun 09 2017 11:43
Oh wait. I think I now get you. You meant the directives that drive query execution (at runtime) are the unsupported ones, and the ones only used during schema generation are supported?
Barry
@_bkern_twitter
Jun 09 2017 14:35
Is a GraphQLSchema expected to only have one .query(type) on it ...Was trying to define multiple root queries so I put two on my schema but I notice its not working how I expect.
Barry
@_bkern_twitter
Jun 09 2017 14:53
whoops I meant multiple ways to query the root type but what I did was definitely not the right thing
Bojan Tomić
@kaqqao
Jun 09 2017 14:56
:) yeah, you can only have a single root, but multiple fields on the root, where each field translates to a top-level query
Barry
@_bkern_twitter
Jun 09 2017 15:09
:thumbsup:
Johannes Schüth
@Jotschi
Jun 09 2017 15:46
Stupid question.. but is it possible to construct recursive graphql queries? Nesting fragments is not allowed. I assume this is nothing that should be possible?
Bojan Tomić
@kaqqao
Jun 09 2017 15:47
AFAIK, that's not doable...
Barry
@_bkern_twitter
Jun 09 2017 15:48
am I reading the docs right i t sounds like graphql-java gives you the type so it cant accept subscriptions but your on your own for implementation
Bojan Tomić
@kaqqao
Jun 09 2017 15:49
@Jotschi you can't fetch everything under a node either. I'm pretty certain the design goal was to not allow infinite depth query to ever be possible.
@_bkern_twitter Yeah, sort of. Subscriptions are incomplete as of now and not really usable yet... Just some low level foundation is there. You could build a solution on top of it by yourself though, but it's quite a distance from here to there.