I'm looking to write a function like Object.assign
or _.merge
, but that operates on GraphQLSchema
objects.
Suppose I have two instances of GraphQLSchema
, call them Base and Other, and I would like to merge Other into Base to produce a new instance Result such that
- Fields present in exactly one of Base or Other are defined in Result by their original
GraphQLFieldConfig
- Fields present in both are reduced to the
GraphQLFieldConfig
in Other.
It looks as though there is no documented means to do this. Is that correct? If I went the (considerably more dangerous) undocumented route, I've noticed that I could exploit internal properties of the object:
, but I'd prefer not to do that.
Any advice would be appreciated. Thanks in advance!
Please check the library merge-graphql-schemas. I think this may help you