How can we add a new field to an existing schema using graphql-tools #3650
-
I am trying to add a new field to an existing schema using graphql-tools. I am trying using appendObjectFields() without success as below. I am getting error "Cannot query field "newField" on type "Product" transformSchema(schema: GraphQLSchema) {
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You can use mergeSchemas({
schemas: [schema],
typeDefs: ``, // Additional typeDefs here
resolvers: {} // Additional resolvers here
}) |
Beta Was this translation helpful? Give feedback.
-
Thanks for the answer. I have tried with mergeSchemas from @graphql-tools/merge earlier but it gives me following error "Cannot query field "foo" on type "Product". Not sure where I am going wrong. Can you please advice.
|
Beta Was this translation helpful? Give feedback.
You can use
mergeSchemas
from@graphql-tools/merge
https://www.graphql-tools.com/docs/schema-merging