1 | # GraphQL Inspector
|
2 |
|
3 | [![CircleCI](https://circleci.com/gh/kamilkisiela/graphql-inspector.svg?style=shield&circle-token=d1cd06aba321ee2b7bf8bd2041104643639463b0)](https://circleci.com/gh/kamilkisiela/graphql-inspector)
|
4 | [![npm version](https://badge.fury.io/js/@graphql-inspector/core.svg)](https://npmjs.com/package/@graphql-inspector/core)
|
5 |
|
6 | **GraphQL Inspector** ouputs a list of changes between two GraphQL schemas. Every change is precisely explained and marked as breaking, non-breaking or dangerous.
|
7 | It helps you validate documents and fragments against a schema and even find similar or duplicated types.
|
8 |
|
9 | ## Features
|
10 |
|
11 | Major features:
|
12 |
|
13 | - **Compares schemas**
|
14 | - **Finds breaking or dangerous changes**
|
15 | - **Validates documents against a schema**
|
16 | - **Finds similar / duplicated types**
|
17 | - **Schema coverage based on documents**
|
18 | - **Serves a GraphQL server with faked data and GraphQL Playground**
|
19 |
|
20 | GraphQL Inspector has a **CLI** and also a **programatic API**, so you can use it however you want to and even build tools on top of it.
|
21 |
|
22 | ## Installation
|
23 |
|
24 | ```bash
|
25 | yarn add @graphql-inspector/core
|
26 | ```
|
27 |
|
28 | ## Examples
|
29 |
|
30 | ```typescript
|
31 | import {
|
32 | diff,
|
33 | validate,
|
34 | similar,
|
35 | coverage,
|
36 | Change,
|
37 | InvalidDocument,
|
38 | SimilarMap,
|
39 | SchemaCoverage,
|
40 | } from '@graphql-inspector/core';
|
41 |
|
42 | // diff
|
43 | const changes: Change[] = diff(schemaA, schemaB);
|
44 | // validate
|
45 | const invalid: InvalidDocument[] = validate(documentsGlob, schema);
|
46 | // similar
|
47 | const similar: SimilarMap = similar(schema, typename, threshold);
|
48 | // coverage
|
49 | const schemaCoverage: SchemaCoverage = coverage(schema, documents);
|
50 | // ...
|
51 | ```
|
52 |
|
53 | ## License
|
54 |
|
55 | [MIT](https://github.com/kamilkisiela/graphql-inspector/blob/master/LICENSE) © Kamil Kisiela
|