
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
@apollographql/graphql-language-service-utils
Advanced tools
Utilities to support the GraphQL Language Service
@apollographql/graphql-language-service-utils is a utility package designed to assist with GraphQL language services. It provides various tools and utilities to help with tasks such as parsing, validation, and completion of GraphQL queries and schemas.
GraphQL Parsing
This feature allows you to parse a GraphQL query string into an Abstract Syntax Tree (AST). The `parse` function takes a query string and returns its AST representation.
const { parse } = require('@apollographql/graphql-language-service-utils');
const query = `query { user(id: 1) { name } }`;
const parsedQuery = parse(query);
console.log(parsedQuery);
GraphQL Validation
This feature allows you to validate a GraphQL query against a schema. The `validate` function takes a schema and a parsed query, and returns an array of validation errors, if any.
const { validate } = require('@apollographql/graphql-language-service-utils');
const { buildSchema } = require('graphql');
const schema = buildSchema(`type Query { user(id: ID!): User } type User { id: ID! name: String }`);
const query = `query { user(id: 1) { name } }`;
const errors = validate(schema, parse(query));
console.log(errors);
GraphQL Completion
This feature provides autocomplete suggestions for a given position in a GraphQL query. The `getAutocompleteSuggestions` function takes a schema, a query string, and a position, and returns a list of suggestions.
const { getAutocompleteSuggestions } = require('@apollographql/graphql-language-service-utils');
const { buildSchema } = require('graphql');
const schema = buildSchema(`type Query { user(id: ID!): User } type User { id: ID! name: String }`);
const query = `query { user(`;
const suggestions = getAutocompleteSuggestions(schema, query, { line: 1, character: 12 });
console.log(suggestions);
The `graphql` package is the core reference implementation of GraphQL for JavaScript. It provides tools for parsing, validating, executing, and introspecting GraphQL queries. Compared to @apollographql/graphql-language-service-utils, it offers a more comprehensive set of features but may require more setup for language service-specific tasks.
The `graphql-tools` package provides a set of utilities for building and manipulating GraphQL schemas. It includes features for schema stitching, mocking, and schema transformations. While it overlaps with some functionalities of @apollographql/graphql-language-service-utils, it is more focused on schema construction and manipulation rather than language services.
The `codemirror-graphql` package integrates GraphQL language support into the CodeMirror editor. It provides syntax highlighting, linting, and autocomplete features for GraphQL. This package is more specialized for editor integration compared to @apollographql/graphql-language-service-utils, which offers a broader range of utilities for language services.
Utilities to support the GraphQL Language Service.
FAQs
Utilities to support the GraphQL Language Service
We found that @apollographql/graphql-language-service-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.