Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions spec/Section 3 -- Type System.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ type system where those operations begin.
The {`query`} _root operation type_ must be provided and must be an Object type.

The {`mutation`} _root operation type_ is optional; if it is not provided, the
service does not support mutations. If it is provided, it must be an Object
type.
service does not support mutations. If it is provided, it must be an Object type
that does not implement interfaces.
Comment on lines +147 to +148
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
service does not support mutations. If it is provided, it must be an Object type
that does not implement interfaces.
service does not support mutations. If it is provided, it must be an Object type
that does not implement any interface and is not a member of any union.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If we were to also restrict the mutation and subscription root type from being a member of a union, I think that validation should go here instead?

https://github.com/graphql/graphql-spec/blob/September2025/spec/Section%203%20--%20Type%20System.md?plain=1#L1452-L1457

Since it would make the union type invalid, not the root type?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see what you’re saying, but a union won’t know whether something is a root operation type or not. Nothing knows that until the schema itself is constructed, I think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think the whole schema has to be constructed in either case? At least in GraphQL-JS we know what the root types are when validating union members.

is not a member of any union

To translate this to code we'd have to iterate through each type, find all unions and then check each member to see if it's the same as the root type.

Adding it to the union validation we just need to get the root subscription and mutation types from the schema and check against each member.


Similarly, the {`subscription`} _root operation type_ is also optional; if it is
not provided, the service does not support subscriptions. If it is provided, it
must be an Object type.
must be an Object type that does not implement interfaces.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
must be an Object type that does not implement interfaces.
must be an Object type that does not implement any interface and is not a
member of any union.


The {`query`}, {`mutation`}, and {`subscription`} root types must all be
different types if provided.
Expand Down
Loading