npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

graphql-schema-parser

v1.0.9

Published

parses a GraphQL schema file and generates an object that represents it. Follows 2018 GraphQL schema specification. Has no dependencies

Readme

GraphQL Schema Parser

npmjs link: https://www.npmjs.com/package/graphql-schema-parser

Description

This is a minimal, tool with documented source code, and well defined type definitions used to parse graphql schema text according to the 2018 spec. It generates an object that has properties corresponding to the input graphql schema. There are absolutely no dependencies, this utility was made using only the basic node libraries. It is intended to be simple minimal and easy to use so you can extend it to whatever use that fits your needs. This module is fairly simple and follows the current graphql 2018 spec including nested directives.

Use Cases

I built this tool so that any commonly used object within the entire scope of a project, such as error events, general logs etc. can also be defined using a graphql schema specification. This standardizes the language throught a project such that the end points and internal domain language throughout the project would be concretely specified using the same specification. This is useful as many projects have their own domain specific languages for interacting with components or services. In order to utilize this library you must issue at the root

npm install graphql-schema-parser
import { generateSchemaObject } from 'graphql-schema-parser'

Then you can use the schema object as you desire. Thats all there is needed, a single funcitonal call

Quick Type Defintion Reference, as always the files inside the ./typedefs are the most accurate.

The most basic type that has a single mandatory property

NamedComponent:{
name:string
}
NameIndex<ObjectDefinition>

This object represents a map whose key is some string (generally the name or id) and value is the defined generic TYPE

NameIndex<TYPE>
isExtended:boolean
implements?:NameIndex<NamedComponent>; //For object types only
name:string;
fields:NameIndex<TYPE extends InputFieldDefinition|ParameterFieldDefinition>;
directives?:NameIndex<DirectiveAnnotations>;
description?:string

All element based objects (objects that list out items, and do not define fields) will have the same properties as the above except instead of fields it has:

elements:NameIndex<TYPE extends Element>;

the elements indexed are generally some NamedComponent restricted by an enumeration

type:string
name:string
description?:string
directives?:NameIndex<DirectiveAnnotations>;
parameters?:NameIndex<ParameterFieldDefinition>;

otherwise the parmeters is defined as

parameters?:NameIndex<InputFieldDefinition>;

All Parameters that belong to a field that can be parameterized can contain

type:string
name:string
directives?:NameIndex<DirectiveAnnotations>;
description?:string
name:string,
parameters?:NameIndex<ParameterComponent>;
type:string
name:string
directives?:NameIndex<DirectiveAnnotations>;