Skip to content

Conversation

@jwaldrip
Copy link
Contributor

Summary

This adds full TypeSystem directive support as requested in issue #1003.

Changes

  • Add applied_directives field to all Type structs (Object, Scalar, Field, Interface, Union, Enum, InputObject, Argument, Enum.Value)
  • Preserve applied directives through the build phase from Blueprint to final Type structs
  • Add __AppliedDirective and __DirectiveArgument introspection types
  • Add appliedDirectives field to __Type, __Field, __InputValue, and __EnumValue introspection types

Supported Locations

TypeSystem directives can be applied to all spec-defined locations:

  • SCHEMA, SCALAR, OBJECT, FIELD_DEFINITION, ARGUMENT_DEFINITION
  • INTERFACE, UNION, ENUM, ENUM_VALUE, INPUT_OBJECT, INPUT_FIELD_DEFINITION

The directive expand callback continues to work for transforming type definitions at compile time, and applied directives are now visible through introspection queries.

Example Introspection

{
  __type(name: "User") {
    appliedDirectives {
      name
      args {
        name
        value
      }
    }
  }
}

Closes #1003

Test plan

  • Added comprehensive TypeSystem directive tests (25 new tests)
  • All 1467 tests pass
  • Tested directive application on all type system elements
  • Verified introspection returns applied directives correctly

🤖 Generated with Claude Code

This adds full TypeSystem directive support as requested in issue absinthe-graphql#1003:

- Add `applied_directives` field to all Type structs (Object, Scalar,
  Field, Interface, Union, Enum, InputObject, Argument, Enum.Value)
- Preserve applied directives through the build phase from Blueprint
  to final Type structs
- Add `__AppliedDirective` and `__DirectiveArgument` introspection types
- Add `appliedDirectives` field to `__Type`, `__Field`, `__InputValue`,
  and `__EnumValue` introspection types
- TypeSystem directives can be applied to all spec-defined locations:
  SCHEMA, SCALAR, OBJECT, FIELD_DEFINITION, ARGUMENT_DEFINITION,
  INTERFACE, UNION, ENUM, ENUM_VALUE, INPUT_OBJECT, INPUT_FIELD_DEFINITION

The directive `expand` callback continues to work for transforming
type definitions at compile time, and applied directives are now
visible through introspection queries.

Closes absinthe-graphql#1003

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jwaldrip jwaldrip force-pushed the feat/typesystem-directives branch from 5d8f1f5 to ccfd7c7 Compare January 13, 2026 15:17
@jwaldrip
Copy link
Contributor Author

jwaldrip commented Feb 6, 2026

Any thoughts on the TypeSystem directives support? This adds introspection for directives applied to schema types. Would love any feedback or concerns.

@jwaldrip jwaldrip marked this pull request as ready for review February 6, 2026 18:44
@cschiewek
Copy link
Member

I'm in favour of adding the applied_directives field to all the type structs, but definitely against the new introspection types as they are not part of the spec. IMO, if folks want to extend the introspection schema, it should be a seperate package / plugin.

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.

Support TypeSystem Directives

2 participants