Programmatic GraphQL schema builder with a type registry for constructing and editing output/input types, fields, arguments, and interfaces. v9.1.0 (stable) supports GraphQL v14–16, ships TypeScript definitions, and is ESM-only. Key differentiators vs graphql-tools: Resolver abstraction for CRUD operations, built-in projection parser from AST, OutputType-to-InputType converter, and plugin ecosystem (mongoose, JSON, Elasticsearch). Releases ~monthly; recent fixes address security (removed object-path) and TypeScript compatibility.
npm install graphql-composeVerified import paths — ran on the pinned version, not inferred.
Creates an object type composer for User, adds a resolver, attaches to Query root, builds schema.
Upgrade graphql to v14, v15, or v16. If locked to v13, stay on graphql-compose v8.
Use import statements or dynamic import(). If CJS required, stick with v8.
If using deep path access, migrate to ES2020 optional chaining or lodash.get.
Use import { schemaComposer } for shared app schema; use new SchemaComposer() for isolated test contexts.Consider using addFields or removeField methods; check for deprecation warnings in v10.
Ensure the type is created (e.g., schemaComposer.createObjectTC) before referencing it in resolver type field.
Do not create an object type composer with same name as root types. Use schemaComposer.Query directly.
Verify resolver returns an object matching UserTC fields and that schemaComposer.buildSchema() is called after adding resolvers.
npm install graphql@^14.2.0 || ^15.0.0 || ^16.0.0