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

1st
Jun 2017
Andrew Potter
@apottere
Jun 01 2017 04:52
@heruan there's also https://github.com/graphql-java/graphql-java-servlet, which allows you to expose your schema as a servlet
Brad Baker
@bbakerman
Jun 01 2017 05:01
yup there are much more complete examples - but I would a main jump point (graphql-java) to have at least a basic example
Andreas Marek
@andimarek
Jun 01 2017 05:05
@kaqqao there are some use cases where you can have multiple fields (using fragments). But the fields must be completely identically (this is the job of the validation phase to make sure it is so) and therefore we can just use the first field
@kaqqao actually you answered this yourself some time ago, if I remember correctly :-)
Bojan Tomić
@kaqqao
Jun 01 2017 06:21
@andimarek Yup, you're right. It's just that I discovered in the meantime that the sub-selections and arguments can differ between the fields... so I got confused again​ 😶 It​ seems like Sangria combines the arguments in this case (I didn't verify this) while graphql-java and the ref. impl take only the args from the first field and discard the rest...
Brad Baker
@bbakerman
Jun 01 2017 06:47
can you give an query example?
sub selections should be handled by other data feathers no?
Bojan Tomić
@kaqqao
Jun 01 2017 07:03

Sure. Consider the following query:

{
    customer(id: 123) {
        ...orderInfo
        orders(category: "groceries") {
            orderDate
        }
    }
}

fragment orderInfo on Customer {
    orders(since: "2017-01-01") {
        orderDate
        totalPrice
    }
}

This would result in 2 Fields for the orders fetcher with different sub-selections (as expected, I think), but the arguments map the fetcher gets would be "category" -> "groceries" only, and "since" -> "2017-01-01" would get (irretrievably) lost.
The ref. impl. does the same, so I'm not saying it's incorrect, I just found this really odd.

Brad Baker
@bbakerman
Jun 01 2017 07:04
that seems wrong in us and reference impl
I suspect its wrong when I see that
Bojan Tomić
@kaqqao
Jun 01 2017 07:06
Agreed. I'll open an issue for the ref. impl. and see what happens.
Not sure whether you'd want to do anything in graphql-java as of now... I could make a PR that merges the maps, or just open an issue to track wat happens in the ref. impl, or nothing at all.
Intuitively, I'd expect that each individual field triggers its own fetcher, with its own arguments, and its own sub-selection. But since it combines the fields, I'd at least expect it to combine the arguments.
Brad Baker
@bbakerman
Jun 01 2017 07:08
yeah I would think that it should combine the arguments as it combines the fields
fragments are meant to be a merge (as I understand them)
Bojan Tomić
@kaqqao
Jun 01 2017 07:18
Argh. Ignore me, please. The whole thing causes a validation error if the fields don't get aliases.
and if they do, the fetcher gets invoked separately
I was sleep deprived when I was looking into it :(
Sorry for the confusion...
Sergei Egorov
@bsideup
Jun 01 2017 08:41
Hi! Do you have any aprox ETA for 4.0.0?
Brad Baker
@bbakerman
Jun 01 2017 11:26
not yet - 3.0.0 just went out maybe 2 weeks ago so 4.0.o is a little way off yet
why what are you after?