Using extend type
with GraphQL API
#3266
Answered
by
IvanGoncharov
bombillazo
asked this question in
Q&A
-
Hello, how can I represent the following SDL schema : type MyType {
prop: Int
}
extend type MyType {
newProp: String
} With the I have different files where I programmatically create my schema and want a "common" Query and Mutation type from which all modules extend to add their functions. |
Beta Was this translation helpful? Give feedback.
Answered by
IvanGoncharov
Sep 21, 2021
Replies: 2 comments 1 reply
-
Don't think it is possible yet #1569 |
Beta Was this translation helpful? Give feedback.
0 replies
-
With const myType = new GraphQLObjectType({
name: 'MyType',
fields: {
'prop': { type: GraphQLInt },
},
}); you can do the following: const myTypeConfig = myType.toConfig();
const exptendedMyType = new GraphQLObject({
...myTypeConfig,
fields: {
...myTypeConfig.fields,
newProp: { type: GraphQLString },
},
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
saihaj
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With
you can do the following: