Skip to content

Add OperationDefinitionNode.shorthand - #4966

Open
martinbonnin wants to merge 1 commit into
17.x.xfrom
4901
Open

martinbonnin wants to merge 1 commit into
17.x.xfrom
4901

Conversation

@martinbonnin

@martinbonnin martinbonnin commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4901

When doing an AST parse - print roundtrip, the presence of the query keyword is important:

# this is a type with a single field `bar`
type Foo

{ bar } 

# this is a type followed by a query
type Foo

query { bar }

So we need to remember the presence of the keyword.

Ideally, OperationDefinitionNode.operation would be made optional but that's a breaking change so I went with a separate boolean instead.

@vercel

vercel Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
graphql-js Ignored Ignored Preview Oct 30, 2026 2:52pm UTC

Request Review

@martinbonnin martinbonnin changed the title Add OperationDefinitionNode.shorthand Add OperationDefinitionNode.shorthand Oct 30, 2026

This branch has not been deployed

No deployments
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.

print() can change a document's meaning: shorthand query after a definition without a body

1 participant