Skip to content

feat: support plain GraphQL introspection - #87

Merged
vito merged 2 commits into
mainfrom
plain-graphql-introspection
Jun 4, 2026
Merged

vito merged 2 commits into
mainfrom
plain-graphql-introspection

Conversation

@vito

@vito vito commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Problem

Dang's introspection query assumed Dagger's GraphQL extensions — directives selections on __Field, __EnumValue, and __InputValue, plus the _DirectiveApplication type. Plain spec-compliant endpoints like GitHub's reject those fields, so any non-Dagger import failed during introspection:

introspecting https://api.github.com/graphql: introspection query failed:
input:41:5: fragment FullType.fields.directives Field 'directives' doesn't exist on type '__Field'
...
input:77:1: fragment DirectiveApplication No such type _DirectiveApplication

Changes

  • Split the introspection query in two: introspection.graphql is now the spec-compliant default, and introspection_dagger.graphql carries the Dagger directive extensions (embedded as Query and DaggerQuery).
  • introspectSchema/IntrospectSchema take a dagger bool to pick between them, threaded through each call site from the import's Dagger setting. Dagger module/session paths pass true; endpoint imports pass source.Dagger.
  • Renamed the GitHub demo's loop binding node → issue so it doesn't collide with the root node field when Dagger is auto-imported alongside (which happens when running the demo from inside this repo, itself a Dagger module).

Testing

GITHUB_TOKEN=$(gh auth token) go run ./cmd/dang ./demos/github now introspects GitHub and runs the full demo (repo stats, issues, union-type search). Existing pkg/dang tests pass.

The introspection query assumed Dagger's GraphQL extensions, which expose
directive applications on fields, enum values, and input values via a
_DirectiveApplication type. Plain spec-compliant endpoints like GitHub's
reject those selections, so any non-Dagger import failed to introspect.

Split the query in two: introspection.graphql is now the spec-compliant
default, and introspection_dagger.graphql carries the Dagger extensions.
introspectSchema takes a dagger flag to pick between them, threaded through
each call site from the import's Dagger setting.

Also rename the github demo's loop binding from node to issue so it does not
collide with the root node field when Dagger is auto-imported alongside.

Signed-off-by: Alex Suraci <[email protected]>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

TestExpectedTypeDirectivesFromIntrospection relies on the test server's
extended introspection to surface applied @expectedType directives. Now that
introspection defaults to the spec-compliant query, the import must opt into
the Dagger query by setting Dagger: true on its ImportConfig.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito merged commit a64f7ae into main Jun 4, 2026
6 checks passed
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