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 pageshowhide
explore
- Built-in & Custom Scalars4 questions
- Object Types & Field Arguments3 questions
- Interfaces & Unions3 questions
- Enums & Input Objects4 questions
- Nullability & List Modifiers3 questions
- Directive Definitions3 questions
- Schema Definition & Extensions4 questions
- Introspection Schema4 questions
- Schema-First & Code-First4 questions
- Schema Validity Rules3 questions
- Applying Custom Directives3 questions
questions
page 2 of 2In a code-first GraphQL server, why can an internal rename break a working client?
basics
~20 sBecause 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.
How do you keep GraphQL contract review meaningful when the schema is derived from code?
basics
~20 sGive 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.
What does GraphQL's @specifiedBy directive attach to a custom scalar, and who reads it?
basics
~20 sIt 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.
How do you document a type or field in GraphQL SDL, and why is a `#` comment not enough?
basics
~20 sPut 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.
What does the @oneOf directive on a GraphQL input object type require, and is it in the specification?
basics
~20 sIt 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.
What does a GraphQL introspection result report about a field's arguments and their defaults?
basics
~20 sEach 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.
Why does GraphQL introspection not show where a custom directive is applied?
basics
~20 sIntrospection 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.
Why can a recursive input object make a schema fail validation?
basics
~20 sA 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.
showing 31–38 of 38