You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

graphql-language-service-utils

Package Overview
Dependencies
Maintainers
13
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-language-service-utils

Utilities to support the GraphQL Language Service


Version published
Weekly downloads
125K
increased by10.93%
Maintainers
13
Created
Weekly downloads
 

Package description

What is graphql-language-service-utils?

The graphql-language-service-utils package provides utility functions for working with GraphQL language services. It includes features for parsing, validating, and formatting GraphQL queries, as well as for handling GraphQL schema and documents.

What are graphql-language-service-utils's main functionalities?

parseGraphQL

This feature allows you to parse a GraphQL query string into an Abstract Syntax Tree (AST). The code sample demonstrates how to parse a simple GraphQL query.

const { parse } = require('graphql-language-service-utils');
const query = `query { user(id: 1) { name } }`;
const parsedQuery = parse(query);
console.log(parsedQuery);

validateGraphQL

This feature allows you to validate a GraphQL query against a given schema. The code sample demonstrates how to validate a simple GraphQL query using a schema.

const { validate } = require('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);

formatError

This feature allows you to format GraphQL errors in a standardized way. The code sample demonstrates how to format a simple error message.

const { formatError } = require('graphql-language-service-utils');
const error = new Error('Something went wrong');
const formattedError = formatError(error);
console.log(formattedError);

Other packages similar to graphql-language-service-utils

Readme

Source

graphql-language-service-utils

NPM npm downloads LicenseAPI DocsDiscord Channel

Utilities to support the GraphQL Language Service and the rest of the language ecosystem.

Keywords

FAQs

Package last updated on 06 Dec 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc