You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

apollo-language-server

Package Overview
Dependencies
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-language-server

A language server for Apollo GraphQL projects

1.26.9
latest
Source
npmnpm
Version published
Weekly downloads
194K
0.59%
Maintainers
1
Weekly downloads
 
Created

What is apollo-language-server?

The apollo-language-server npm package provides tools and utilities for working with GraphQL schemas and operations in an Apollo-based environment. It offers features such as schema validation, query validation, and more, making it easier to develop and maintain GraphQL APIs.

What are apollo-language-server's main functionalities?

Schema Validation

This feature allows you to validate a GraphQL schema to ensure it adheres to the GraphQL specification. The code sample demonstrates how to validate a simple schema and log any validation errors.

const { validateSchema } = require('apollo-language-server');
const schema = `type Query { hello: String }`;
const errors = validateSchema(schema);
if (errors.length > 0) {
  console.error('Schema validation errors:', errors);
} else {
  console.log('Schema is valid');
}

Query Validation

This feature allows you to validate a GraphQL query against a given schema. The code sample shows how to validate a query and log any validation errors.

const { validateQuery } = require('apollo-language-server');
const schema = `type Query { hello: String }`;
const query = `{ hello }`;
const errors = validateQuery(schema, query);
if (errors.length > 0) {
  console.error('Query validation errors:', errors);
} else {
  console.log('Query is valid');
}

Schema Parsing

This feature allows you to parse a GraphQL schema into an abstract syntax tree (AST). The code sample demonstrates how to parse a schema and log the resulting AST.

const { parseSchema } = require('apollo-language-server');
const schema = `type Query { hello: String }`;
const parsedSchema = parseSchema(schema);
console.log('Parsed schema:', parsedSchema);

Other packages similar to apollo-language-server

FAQs

Package last updated on 04 May 2022

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