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

28th
Jun 2017
Barry
@_bkern_twitter
Jun 28 2017 14:55
what about options for paging
Philippe Riand
@philriand_twitter
Jun 28 2017 15:25
Not sure if they is a way to get that supported out of the box. I'd like to define a field with a selection like project(id: 'myid'). But I would like the argument to be the value of a field from the current source. For example:
```
{
aprojectid,
project(id: aprojectid)
}
I got that to work by using a specific syntax in my code for the argument : project(id: "${aprojectid}"). It works pretty well, except that it forces the argument to be defined as a string. Moreover, when evaluating the field 'project', I need to get access to
the other fields of the source
Sorry I'm not used to this forum and I press enter to quickly...
Barry
@_bkern_twitter
Jun 28 2017 15:48
@kaqqao thanks
Bojan Tomić
@kaqqao
Jun 28 2017 15:56
@philriand_twitter I don't fully understand what you're asking, but I think this post would answer it: https://stackoverflow.com/questions/44159753/java-graphql-pass-field-values-to-resolver-for-objects/44179252#44179252
But... why would you provide and argument value that only says to get the real value from the source? Why not just check if the argument is provided and if not - get the value from the source (for example)?
argument are something that the client provides... if the value is always coming from elsewhere, why is it even an argument?
Philippe Riand
@philriand_twitter
Jun 28 2017 16:30
Thanks for the link.I'd like to pass the argument value from the source because t
hat argument might not be known by the GraphQL schema.
Suppose, for example, that I'd like to link 2 JSON documents coming from Mongo without knowing their JSON schema when composing the service. The consumer of the service will define the navigation link 'dynamically', as opposed to that this wired in the service. See an example here: http://blog.riand.com/2017/03/schemaless-graphql.html
Bojan Tomić
@kaqqao
Jun 28 2017 20:34
Oh, schemaless GraphQL is a very different world... Sorry, no clue about it :(