Chat on WhatsApp

How do I add a custom GraphQL resolver without breaking the schema cache?

Three files, in this order. (1) etc/schema.graphqls — declare the type and the field; (2) a Resolver class implementing Magento\Framework\GraphQl\Query\ResolverInterface; (3) wire it in the schema with @resolver(class: "Vendor\\Module\\Resolver\\Foo"). After every schema edit run bin/magento cache:clean config graphql_query_resolver_cache. Don't skip config — the schema-stitcher caches the parsed AST there, not under graphql_query_resolver_cache. If your new field still 404s, run bin/magento setup:di:compile; resolver-class autoloading goes through generated factories.

Was this helpful?