Repository navigation
fix(api): validate the whole selection set against the schema - #134
Merged
Merged
Conversation
…field
The parser encoded `... on T { … }` as a field named T with nothing to
tell it apart from a real field, so the executor resolved it as an
unknown field ("Domain": null) and every consumer had to guess from the
name. Mark inline fragments explicitly; the executor splices their
selections in like a named fragment, and complexity charges them at the
spread's depth like one.
Served with real handlers but absent from schema.graphql, so invisible to introspection and about to become hard errors once selections are validated: - Domain.namehash, Domain.domain, Domain.subdomainConnection(first), Domain.eventsConnection(first) - Registration.block, Registration.blockNumber, Registration.timestamp - ResolverDetail: the 17 Resolver fields resolver(id:) and resolversByOwner serve by delegating to the per-name builder at the zero node (the resolver-wide default record on record-model resolvers) The nested connections are declared with the `first` they honour and no `after`, which they have never supported.
An unknown field in a selection set resolved to null, indistinguishable
from a genuine absence, and arguments were only checked on root fields:
{ domains(where:{bogus:1}) } was a 400 while the same typo one level
down silently dropped the filter.
The validator now walks every operation at every depth, through named,
inline and root-level fragments, and rejects unknown fields, unknown or
missing arguments and unknown input-object fields (including inside
lists) wherever they appear. Fragment type conditions must name the
enclosing type, since the schema has no interfaces or unions. Named
fragments are walked once per operation, and keys are built on the
stack instead of allocated per selection.
Also fixes a false rejection: a fragment spread at the root named after
a root field was validated as that field and failed its required-arg
check. Unknown root fields keep the executor's UnknownRootField.
v1rtl
force-pushed
the
fix/reject-unknown-output-fields
branch
from
September 29, 2026 13:56
d2e4592 to
44a131f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An unknown field in a selection set resolved to null, which looks exactly like a value that is genuinely absent:
Arguments were checked only on root fields.
{ domains(where:{bogus:1}) }was a 400, but the same typo one level down silently dropped the filter.Changes
Declare what is served first (
4e9fa62). An audit of every builder and hand-written serializer againstschema.graphqlfound these served but undeclared. Without this commit, strict validation would have turned working queries into whole-response errors, and no golden selected them.Domain.namehash,Domain.domain,Domain.subdomainConnection(first),Domain.eventsConnection(first). The connections are declared with only thefirstthey honour (max 100) and noafter, which they never supported; the descriptions point to the real pagers.Registration.block,.blockNumber,.timestamp.ResolverDetail: the 17Resolverfields thatresolver(id:)/resolversByOwnerserve by delegating to the per-name builder at the zero node. On record-model resolvers that is the resolver-wide default record, so some return real data; the descriptions say so.RegistryInfo, connections, coverage/finality,_meta, roles, approvals and metadata. Nested argument reads match their declarations too.Validate the whole document (
44a131f). The validator now walks every operation at every depth, through named, inline and root-level fragments. It rejects:`Domain.subdomains` has no argument `bogus`)where: { or: [ … ] })It also:
UnknownRootFielderrorInline fragments (
b785d70)... on T { … }as a field namedT, so validation had to guess from the name. An empty inline fragment was wrongly rejected, and the first interface added would have broken the guess."Domain": null).Behaviour changes for clients
VALIDATION_ERRORinstead of null or silently ignored.skiponDomain.eventsand on the nested connections: they parse it but have never applied it.... on Domain { labelName }now returnslabelNameinstead of"Domain": null.Tests
ok_typename_and_fragmentschange (the inline fragment now resolves), no existing golden changed, so no current conformance query is newly rejected.Known, not fixed here
pageInfoandcursorwhether or not they are selected, and theasXevent payloads emit every key.events.Domain.events(where:)honours only part ofEventFilter(type, type_in, contractAddress, block/timestamp bounds). Other declared filter fields validate but are ignored.zig build test-all: 89/89 steps, 1493/1493 tests (zig 0.16.0). All three PRs also merge cleanly together ontostagingand passtest-allcombined.