graphql operation validation against schema
Validates GraphQL client operations (queries, mutations, subscriptions) against a GraphQL schema by parsing operation documents and comparing them against schema definitions. Uses a compiler-based approach that normalizes operations into an intermediate representation, then checks field existence, argument types, fragment spreads, and return types. Integrates with Apollo Studio for schema retrieval and caching.
Unique: Uses a multi-pass compiler architecture (apollo-codegen-core) that normalizes operations into an intermediate representation before validation, enabling language-agnostic validation that feeds into language-specific code generators. Integrates directly with Apollo Studio for schema versioning and operation registry tracking.
vs alternatives: Tighter integration with Apollo Studio than standalone tools like graphql-cli, enabling schema versioning and operation registry features beyond basic validation
typescript type generation from graphql operations
Generates fully-typed TypeScript interfaces and types from GraphQL operation documents by parsing operations, resolving them against a schema, and emitting TypeScript AST that maps GraphQL types to TypeScript equivalents. Handles nested fragments, unions, interfaces, and custom scalars through a multi-pass compilation pipeline. Generates both operation result types and variable input types with proper null-safety semantics.
Unique: Implements a schema-aware code generator that preserves GraphQL semantics in TypeScript (nullable vs non-nullable, union discriminators, fragment spreads) through a dedicated apollo-codegen-typescript package that extends the core compiler. Generates both operation result types and variable types in a single pass, maintaining referential integrity.
vs alternatives: More tightly integrated with Apollo Client than graphql-code-generator, with native support for Apollo-specific patterns like persisted queries and operation registry
schema change detection and breaking change analysis
Analyzes schema changes between versions to detect breaking changes (field removals, type changes, argument removals) and safe changes (new fields, new types). Compares old and new schemas, generates a change report categorizing each change by severity, and identifies which operations are affected by breaking changes. Integrates with Apollo Studio for schema history tracking.
Unique: Implements structural schema diffing that compares type definitions, fields, arguments, and return types to categorize changes by severity. Integrates with Apollo Studio's schema history for tracking changes over time and correlating with operation registrations.
vs alternatives: Integrated breaking change detection vs standalone tools like graphql-inspector; tighter Apollo Studio integration for schema versioning
custom scalar type mapping and code generation
Provides a configuration system for mapping GraphQL custom scalars to language-specific types (e.g., DateTime scalar to JavaScript Date or TypeScript Date type). Supports per-language scalar mappings, custom serialization/deserialization logic, and scalar validation. Enables code generators to emit correct types for custom scalars without manual post-processing.
Unique: Provides a declarative scalar mapping system in apollo.config.js that allows mapping GraphQL custom scalars to language-specific types. Code generators use these mappings to emit correct type annotations without requiring manual post-processing.
vs alternatives: Built-in scalar mapping vs manual type casting in generated code; reduces boilerplate and improves type safety
fragment-based code generation and reuse
Supports GraphQL fragments in code generation, enabling reusable type definitions across multiple operations. Fragments are compiled into language-specific types that can be composed into larger operation types. Handles fragment spreads, nested fragments, and inline fragments with proper type inference and union discrimination.
Unique: Implements fragment compilation as first-class feature in apollo-codegen-core, generating separate types for fragments that can be composed into operation types. Supports nested fragments and inline fragments with proper type inference.
vs alternatives: Native fragment support vs tools requiring manual fragment type composition; reduces boilerplate for fragment-heavy codebases
flow type generation from graphql operations
Generates Flow type annotations from GraphQL operations by compiling operations against a schema and emitting Flow-compatible type definitions. Handles Flow-specific features like exact object types, union discriminators, and opaque types. Maintains feature parity with TypeScript generation but targets Flow's type system semantics.
Unique: Dedicated apollo-codegen-flow package that extends the core compiler to emit Flow-specific syntax (exact types, opaque types, variance). Maintains parallel implementation with TypeScript generator, allowing projects to generate both simultaneously.
vs alternatives: Only major tool providing Flow code generation for GraphQL; most alternatives (graphql-code-generator) focus exclusively on TypeScript
swift code generation from graphql operations
Generates Swift types and API client code from GraphQL operations by parsing operations, resolving against schema, and emitting Swift structs, enums, and protocol definitions. Handles Swift-specific patterns like Codable conformance, optionals, and associated types. Generates both model types and a type-safe query builder API for iOS/macOS clients.
Unique: Dedicated apollo-codegen-swift package that generates Swift-idiomatic code including Codable conformance, optional handling, and associated types. Integrates with Xcode build system through build phase scripts, enabling incremental code generation during development.
vs alternatives: Only code generator providing first-class Swift support for GraphQL; most alternatives focus on JavaScript/TypeScript ecosystems
graphql operation extraction from source code
Extracts GraphQL operation documents (queries, mutations, subscriptions) embedded in source code files (JavaScript, TypeScript, Swift) by parsing source ASTs and identifying GraphQL string literals or template literals. Supports multiple embedding patterns (gql`` template literals, graphql() function calls, string constants). Outputs extracted operations as standalone .graphql files or inline documents.
Unique: Uses language-specific AST parsers (TypeScript parser for JS/TS, Swift parser for Swift) to identify GraphQL literals within source code, then extracts and normalizes them. Supports multiple embedding patterns through configurable extraction rules in apollo.config.js.
vs alternatives: Integrated extraction within Apollo tooling vs standalone tools like graphql-cli; tighter integration with code generation pipeline
+5 more capabilities