Skip to content

GAP-0002 Add Field Extensions Spec#4

Open
egoodwinx wants to merge 1 commit into
graphql:mainfrom
egoodwinx:field-extensions
Open

GAP-0002 Add Field Extensions Spec#4
egoodwinx wants to merge 1 commit into
graphql:mainfrom
egoodwinx:field-extensions

Conversation

@egoodwinx
Copy link
Copy Markdown

@magicmark
Copy link
Copy Markdown
Contributor

magicmark commented Feb 12, 2026

# This is not valid GraphQL

So is the idea to compile this out of the SDL before passing to a GraphQL server?

@egoodwinx
Copy link
Copy Markdown
Author

egoodwinx commented Feb 12, 2026

So is the idea to compile this out of the SDL before passing to a GraphQL server?

Yes

@magicmark
Copy link
Copy Markdown
Contributor

I think this would benefit then from being layered on top of the soon-to-be-proposed language in the spec to clarify the difference between "human written"(?) schemas and "runtime" schemas. Not required for this to merge, but worth following along!

@benjie wdyt about a dedicated 2xxx range for "language and syntax extensions"?

side note, not directly relevant to this proposal but:

  • since this is valid syntax folks don't need to worry about existing tooling (syntax highlighters, ast parsing functions and such) breaking on schema that uses this - I think it's only invalid at runtime when validation rules get applied.
  • I wonder what should happen if a GAP proposes new syntax - and at that point you're on your own, there's no guarantee that any other tooling would work. Obviously this isn't a problem to worry about for now, and could be solvable in future I imagine with plugins (similar to babel) and whatnot.

@magicmark magicmark mentioned this pull request Mar 5, 2026
Copy link
Copy Markdown

@mjmahone mjmahone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh as a GAP proposal figuring out the difference between a field extension and an original field definition inside an extension is tough, because I think we must have some kind of syntax, or at least a special directive.

I ran into a bunch of bugs before getting an internal representation where fields can be pure extensions, and I still have unresolvable bugs in going from SDL => SchemaSet (then do work on that set) => SDL. It's very frustrating.

Comment thread GAP-0002/DRAFT/INDEX.md
Comment on lines +15 to +17
extend type Query {
id: ID @deprecated(reason: "Use globalId instead")
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think it would be cleaner to do:

Suggested change
extend type Query {
id: ID @deprecated(reason: "Use globalId instead")
}
extend type Query {
extend id: ID @deprecated(reason: "Use globalId instead")
}

Basically you're being explicit that this field DOES already exist but you're adding more to it.

I have this exact situation and have an internal representation that we actually see that I can't do a round trip into the SDL and back into SchemaSet in https://github.com/facebook/relay/blob/main/compiler/crates/schema-set/src/set_exclude.rs#L413

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.

3 participants