Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-schema-linter

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-schema-linter

Command line tool and package to validate GraphQL schemas against a set of rules.

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
57K
decreased by-4.51%
Maintainers
1
Weekly downloads
 
Created
Source

graphql-schema-linter Travis CI

This package provides a command line tool to validate GraphQL schema definitions against a set of rules.

If you're looking to lint your GraphQL queries, check out this ESLint plugin: apollographql/eslint-plugin-graphql.

Install

Yarn:

yarn global add graphql-schema-linter

npm:

npm install -g graphql-schema-linter

Usage

Usage: graphql-schema-linter [options] [schema.graphql]


Options:

  -o, --only <rules>

    only the rules specified will be used to validate the schema

    example: --only FieldsHaveDescriptions,TypesHaveDescriptions

  -e, --except <rules>

    all rules except the ones specified will be used to validate the schema

    example: --except FieldsHaveDescriptions,TypesHaveDescriptions

  -f, --format <format>

    choose the output format of the report

    possible values: json, text

  -s, --stdin

    schema definition will be read from STDIN instead of specified file

  --version

    output the version number

  -h, --help

    output usage information

Built-in rules

DeprecationsHaveAReason

This rule will validate that all deprecations have a reason.

FieldsHaveDescriptions

This rule will validate that all fields have a description.

TypesAreCapitalized

This rule will validate that interface types and object types have capitalized names.

TypesHaveDescriptions

This will will validate that interface types and object types have descriptions.

Output formatters

The format of the output can be controlled via the --format option.

The following formatters are currently available: text, json.

TextFormatter (default)

Sample output:

5:1 The object type `QueryRoot` is missing a description.
6:3 The field `QueryRoot.a` is missing a description.

Each error is prefixed with the line number and column the error occurred on.

JSONFormatter

Sample output:

{
  "errors": [
    {
      "message": "The object type `QueryRoot` is missing a description.",
      "location": {
        "line": 5,
        "column": 1
      }
    },
    {
      "message": "The field `QueryRoot.a` is missing a description.",
      "location": {
        "line": 6,
        "column": 3
      }
    }
  ]
}

FAQs

Package last updated on 05 Aug 2017

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc