We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Original post edited to reflect changes in graphql-tools-fork v6.3.2 that support error mapping.
This is now live in graphql-tools-fork v6.3.2.
Examples are within the tests.
For instance, the following extracts fields from an enclosing type in the original schema:
transformedPropertySchema = transformSchema(propertySchema, [ new ExtendSchema({ typeDefs: ` extend type Property { locationName: String } `, resolvers: { Property: { locationName: createMergedResolver({ fromPath: ['location', 'name'] }), }, }, fieldNodeTransformerMap: { 'Property': { 'locationName': fieldNode => wrapFieldNode(renameFieldNode(fieldNode, 'name'), ['location']), }, }, }), ]);
The following wraps fields in multiple new layers:
transformedPropertySchema = transformSchema(propertySchema, [ new ExtendSchema({ typeDefs: ` extend type Property { outerWrap: OuterWrap } type OuterWrap { innerWrap: InnerWrap } type InnerWrap { id: ID name: String } `, resolvers: { Property: { outerWrap: (parent, args, context, info) => ({ innerWrap: { id: createMergedResolver({ toPath: ['innerWrap', 'id'] })(parent, args, context, info), name: createMergedResolver({ toPath: ['innerWrap', 'name'] })(parent, args, context, info), }, }), }, }, fieldNodeTransformerMap: { 'Property': { 'outerWrap': (fieldNode, fragments) => extractFields({ fieldNode, path: ['innerWrap'], fragments }), }, }, }),
Feedback is welcome!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Original post edited to reflect changes in graphql-tools-fork v6.3.2 that support error mapping.
This is now live in graphql-tools-fork v6.3.2.
Examples are within the tests.
For instance, the following extracts fields from an enclosing type in the original schema:
The following wraps fields in multiple new layers:
Feedback is welcome!
The text was updated successfully, but these errors were encountered: