skip to content

Type System & SDL

The Schema Definition Language and the type system it declares: scalars, objects, interfaces, unions, inputs, nullability modifiers. Interviewers start here because it is the contract others inherit.

part ofGraphQLoverview, primer and where to startread it →
on this pageshow

questions

page 2 of 2

In a code-first GraphQL server, why can an internal rename break a working client?

level: seniorimportance: should knowfreq 46%

basics

~20 s

Because the published field names are derived from server-side identifiers. A refactor that renames a property renames the public field with it, and the rename looks like ordinary internal cleanup in review — no API artefact changed for anyone to notice.

open as a page

How do you keep GraphQL contract review meaningful when the schema is derived from code?

level: principalimportance: should knowfreq 38%

basics

~20 s

Give the derived schema a committed artefact so surface changes show up in review, agree the shape in SDL before it is built, and name an owner for the shared graph's conventions rather than assuming the implementing team reviews the contract.

open as a page

What does GraphQL's @specifiedBy directive attach to a custom scalar, and who reads it?

level: juniorimportance: nice to knowfreq 18%

basics

~20 s

It attaches a URL to a custom scalar definition, pointing at a human-readable specification of how that scalar's values are serialized. The server never fetches or enforces it — humans and tooling read it through introspection.

open as a page

How do you document a type or field in GraphQL SDL, and why is a `#` comment not enough?

level: juniorimportance: nice to knowfreq 21%

basics

~20 s

Put a string literal — usually a triple-quoted block string — immediately before the definition. That description is part of the schema and readable through introspection. A # comment is ignored by the parser and never reaches a client.

open as a page

What does the @oneOf directive on a GraphQL input object type require, and is it in the specification?

level: middleimportance: nice to knowfreq 18%

basics

~20 s

It marks an input object type whose caller must supply exactly one of its fields, with a non-null value. Every field of such an input must be nullable and carry no default. It is a working-draft addition, not part of the last ratified specification edition.

open as a page

What does a GraphQL introspection result report about a field's arguments and their defaults?

level: middleimportance: nice to knowfreq 22%

basics

~20 s

Each field is a __Field record whose args are __InputValue records: name, description, type as a full wrapper chain, and defaultValue. The default is a String holding the value printed as GraphQL source, not a typed JSON value.

open as a page

Why does GraphQL introspection not show where a custom directive is applied?

level: seniorimportance: nice to knowfreq 20%

basics

~20 s

Introspection describes the type system, so it lists a schema's directive definitions but never their applications. The only applications visible are two the meta-schema was given dedicated fields for: deprecated, as isDeprecated and deprecationReason, and specifiedBy, as specifiedByURL.

open as a page

Why can a recursive input object make a schema fail validation?

level: seniorimportance: nice to knowfreq 22%

basics

~20 s

A chain of Non-Null fields that returns to the same input object can never be satisfied by a finite value. The specification requires at least one link in such a cycle to be nullable or a list type.

open as a page

showing 31–38 of 38