Skip to content

Treat unimplemented runtime directive hooks as no-ops - #5739

Merged
rmosolgo merged 1 commit into
rmosolgo:masterfrom
ydah:fix-next-runtime-directive-defaults
Sep 16, 2026
Merged

rmosolgo merged 1 commit into
rmosolgo:masterfrom
ydah:fix-next-runtime-directive-defaults

Conversation

@ydah

@ydah ydah commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

GraphQL::Execution::Next invokes location-specific hooks for runtime directives, but GraphQL::Schema::Directive doesn't provide default implementations for those hooks.

As a result, a custom directive that declares a runtime location without implementing custom behavior raises NoMethodError:

  • resolve_field for fields
  • resolve_fragment_spread for fragment spreads
  • resolve_inline_fragment for inline fragments
  • resolve_operation for operations

The legacy runtime treats these directives as no-ops.

This PR adds default no-op implementations to GraphQL::Schema::Directive, allowing subclasses to override only the hooks they need. It also adds regression coverage for all four runtime locations under Execution::Next.

@rmosolgo

Copy link
Copy Markdown
Owner

Makes sense, thanks 👍

@rmosolgo
rmosolgo merged commit b41dd07 into rmosolgo:master Sep 16, 2026
14 of 15 checks passed
@rmosolgo rmosolgo added this to the 2.6.11 milestone Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants