Hi @cwstra ,
First off, brilliant work on the bindings! I cloned the example and tested it with one of our schemas. Everything works smoothly, but I have a question about fragment support.
I attempted to add a simple query with a fragment, and while the types are generated, the generated types appear to duplicate the fragment within the main query type. When I look at the outgoing query in the browser, it doesn’t include the fragment in the query payload.
Here is my example code:
Dummy.graphql
query Dummy($id: ID!) {
dummy
getSuit(id: $id) {
...SuitFragment
}
}
fragment SuitFragment on Suit {
id
name
}
Which generates:
let gql = GraphqlTag.gql
module SuitFragment = {
let document = gql`
fragment SuitFragment on Suit {
id
name
__typename
}
`
type t = {
id: null<GraphqlBase__Scalars.Int.t>,
name: null<GraphqlBase__Scalars.String.t>,
}
}
let document = gql`
query Dummy($id: ID!) {
dummy
getSuit(id: $id) {
...SuitFragment
__typename
}
}
`
type variables = {
id: GraphqlBase__Scalars.Id.t
}
type t_getSuit = {
id: null<GraphqlBase__Scalars.Int.t>,
name: null<GraphqlBase__Scalars.String.t>,
}
type t = {
dummy: null<array<null<GraphqlBase__Scalars.String.t>>>,
getSuit: null<t_getSuit>,
}
let use = {
open Apollo.UseQuery
let res: config<variables, t> => return<'variables, 'result> = useQuery(document, ...)
res
}
let useLazy = {
open Apollo.UseLazyQuery
let res: config<variables, t> => (config<variables, t> => promise<return<variables, t>>, return<variables, t>) = useLazyQuery(document, ...)
res
}
We have a large schema with many shared fragments, and I would like to use a shared fragment in multiple queries, handling the fragment with a single function. Is this a supported feature?
I really appreciate any help you can provide.