Skip to content

Add clean custom directive support - #51

Draft
zth wants to merge 11 commits into
mainfrom
agent/directives-roadmap
Draft

Add clean custom directive support#51
zth wants to merge 11 commits into
mainfrom
agent/directives-roadmap

Conversation

@zth

@zth zth commented Jul 31, 2026

Copy link
Copy Markdown
Owner

What changed

  • adds a first-class directive and GraphQL constant-value IR
  • defines typed custom directives from ReScript record or abstract types
  • supports ordered @gql.annotate applications across CMT-visible type-system locations
  • validates definitions, locations, repeatability, required/unknown arguments, and constant coercion
  • emits matching SDL, GraphQLDirective instances, GraphQL Tools metadata, and an exact ordered ResGraph projection
  • lowers @specifiedBy to SDL and specifiedByURL
  • adds runtime, negative-diagnostic, generated-schema, multi-schema, and documentation coverage
  • records the remaining Grats and broader GraphQL capability roadmap

Why

ResGraph previously had no general representation for directive definitions or applications. This made schema policy metadata, ecosystem transforms, scalar specification URLs, and future Federation work depend on one-off mechanisms.

The implementation treats directives as schema data. Runtime behavior remains explicit in transforms, plugins, or resolver logic.

User impact

Users can define directives with @gql.directive, apply them with @gql.annotate, inspect them through GraphQL Tools-compatible extensions or ResGraph's ordered projection, and rely on build-time diagnostics.

Local validation

  • native OCaml build and formatter
  • root ReScript/CLI build
  • generated test schema compilation
  • directive SDL parsing, introspection, GraphQL Tools interoperability, ordering, and execution
  • invalid directive diagnostic fixtures
  • interface, authorization, and multi-schema regression paths
  • Docusaurus production build

CI was intentionally not run for this handoff.

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.

1 participant