Closed n1ru4l closed 4 years ago
is it possible to define the fields in another file and import them? I can also add a "addField(type, field) function, but I think we can already accomplish that by importing types/fields from another file
That is the way I went for and I am fine with it for now! Only drawback is circular refs if you try to return the Query type from another field.
My use-case involves schema-stitching, and so I would like the schema output to include extend type Query { ... }
. The main query definition comes from an external schema so I can't just import the fields.
Is there some other way to do that?
@cjol I guess that is a use-case for https://github.com/ardatan/graphql-tools
I was unclear, sorry. I'm using schema-stitching, using graphql-tools. My problem is that one schema is defined externally, and the other is defined by gqtx. I would like to include extend type Query { ... }
inside the schema generated by gqtx so that graphql-tools
can stitch the schemas corectly.
Right now, all I can do is use t.queryType({...})
which generates type Query { ... }
without the extend
keyword. Seeing this, the schema-stitching process will overwrite the other schema's Query definition instead of augmenting it.
I usually try to split up my schema into modules. Is there any way for adding fields to the Query or Mutation types from within another file?