Open Pavel910 opened 1 month ago
This PR adds support for GraphQL resolver decoration., and improves GraphQL related types (mostly typeDefs and resolvers).
// Decorator #1 const lowerCaseName = createResolverDecorator<any, any, Context>( (resolver) => async (parent, args, context, info) => { // Run the original resolver const name = await resolver(parent, args, context, info); // Return a modified value. return name.toLowerCase(); } ); // Decorator #2 const listBooks = createResolverDecorator(() => async () => { return [{ name: "Article 1" }]; }); // Target fields to decorate const decorator1 = createGraphQLSchemaPlugin({ resolverDecorators: { "Query.books": [listBooks], "Book.name": [lowerCaseName], }, });
Jest tests.
Changes
This PR adds support for GraphQL resolver decoration., and improves GraphQL related types (mostly typeDefs and resolvers).
How Has This Been Tested?
Jest tests.