Skip to content

feat: Add schema coordinates support (RFC #794)#1407

Open
jwaldrip wants to merge 2 commits intoabsinthe-graphql:mainfrom
gigsmart:feat/schema-coordinates
Open

feat: Add schema coordinates support (RFC #794)#1407
jwaldrip wants to merge 2 commits intoabsinthe-graphql:mainfrom
gigsmart:feat/schema-coordinates

Conversation

@jwaldrip
Copy link
Copy Markdown
Contributor

Summary

Implement schema coordinates as defined in the GraphQL specification (RFC #794). Schema coordinates provide a standardized, human-readable format for referencing elements within a GraphQL schema.

Changes

  • Add Absinthe.Schema.Coordinate module with parsing, generation, and resolution:

    • Type coordinates: User
    • Field coordinates: User.email
    • Argument coordinates: Query.user(id:)
    • Directive coordinates: @deprecated
    • Directive argument coordinates: @deprecated(reason:)
    • Enum value coordinates: Status.ACTIVE
    • Input field coordinates: CreateUserInput.name
  • Add coordinate introspection support to all introspection types:

    • __Type.coordinate (returns null for wrapped types)
    • __Field.coordinate
    • __InputValue.coordinate (for args and input fields)
    • __EnumValue.coordinate
    • __Directive.coordinate
  • Add helper functions to Phase.Error for attaching schema coordinates to errors

Test plan

  • Added comprehensive coordinate tests
  • Added coordinate introspection tests
  • Added error coordinate helper tests
  • Code compiles successfully

🤖 Generated with Claude Code

Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
Implement schema coordinates as defined in the GraphQL specification.
Schema coordinates provide a standardized, human-readable format for
referencing elements within a GraphQL schema.

This implementation provides:
- Coordinate generation for all schema element types
- Coordinate parsing with validation
- Coordinate resolution against a schema
- Error helper utilities for including coordinates in messages

Note: This does NOT modify the introspection schema. Schema coordinates
are a string format utility, not an introspection extension.

Coordinate formats:
- Type: "User"
- Field: "User.email"
- Argument: "Query.user(id:)"
- Enum Value: "Status.ACTIVE"
- Directive: "@deprecated"
- Directive Argument: "@deprecated(reason:)"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jwaldrip jwaldrip force-pushed the feat/schema-coordinates branch from 81ba7e1 to 71f503f Compare January 13, 2026 15:12
@jwaldrip jwaldrip marked this pull request as ready for review February 6, 2026 18:43
- Move :directive atom clauses before generic clauses in coordinate_for/2
  and coordinate_for/3 to prevent shadowing by pattern match order
- Escape string interpolation in @moduledoc to prevent compile-time eval
- Fix coordinate resolution tests to use "RootQueryType" (Absinthe's
  default query type name) instead of "Query"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cschiewek
Copy link
Copy Markdown
Member

@jwaldrip if you address the CI failures, I'll get this merged.

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