-
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@graphql-inspector organization (#14)
- Loading branch information
1 parent
4abb873
commit 0e718e8
Showing
87 changed files
with
534 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,7 @@ node_modules/ | |
dist/ | ||
yarn.lock | ||
yarn-error.log | ||
**/*/node_modules/ | ||
**/*/dist/ | ||
**/*/yarn.lock | ||
**/*/yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
packages/*/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"files.exclude": { | ||
"**/dist": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,4 @@ | |
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
{ | ||
"name": "example", | ||
"scripts": { | ||
"diff": "node ../dist/cli.js diff ./schemas/schema.graphql ./schemas/new.graphql", | ||
"diff:same": "node ../dist/cli.js diff ./schemas/schema.graphql ./schemas/schema.graphql", | ||
"validate": "node ../dist/cli.js validate ./documents/*.graphql ./schemas/schema.graphql", | ||
"validate:none": "node ../dist/cli.js validate ./no-documents/*.graphql ./schemas/schema.graphql", | ||
"similar": "node ../dist/cli.js similar ./schemas/similar.graphql", | ||
"similar:type": "node ../dist/cli.js similar ./schemas/similar.graphql --type Post", | ||
"similar:loose": "node ../dist/cli.js similar ./schemas/similar.graphql --threshold 0.1", | ||
"serve": "node ../dist/cli.js serve ./schemas/schema.graphql", | ||
"coverage": "node ../dist/cli.js coverage ./documents/*.graphql ./schemas/schema.graphql", | ||
"coverage:write": "node ../dist/cli.js coverage ./documents/*.graphql ./schemas/schema.graphql --silent --write ./coverage.json", | ||
"open-help": "node ../dist/cli.js --help" | ||
"graphql-inspector": "node ../packages/cli/dist/index.js", | ||
"diff": "yarn graphql-inspector diff ./schemas/schema.graphql ./schemas/new.graphql", | ||
"diff:same": "yarn graphql-inspector diff ./schemas/schema.graphql ./schemas/schema.graphql", | ||
"validate": "yarn graphql-inspector validate ./documents/*.graphql ./schemas/schema.graphql", | ||
"validate:none": "yarn graphql-inspector validate ./no-documents/*.graphql ./schemas/schema.graphql", | ||
"similar": "yarn graphql-inspector similar ./schemas/similar.graphql", | ||
"similar:type": "yarn graphql-inspector similar ./schemas/similar.graphql --type Post", | ||
"similar:loose": "yarn graphql-inspector similar ./schemas/similar.graphql --threshold 0.1", | ||
"serve": "yarn graphql-inspector serve ./schemas/schema.graphql", | ||
"coverage": "yarn graphql-inspector coverage ./documents/*.graphql ./schemas/schema.graphql", | ||
"coverage:write": "yarn graphql-inspector coverage ./documents/*.graphql ./schemas/schema.graphql --silent --write ./coverage.json", | ||
"open-help": "yarn graphql-inspector --help" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"version": "0.6.0-alpha.2" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__tests__/ | ||
src/ | ||
jest.config.js | ||
tsconfig.json | ||
tsconfig.test.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
save-exact=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Kamil Kisiela | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# GraphQL Inspector | ||
|
||
[![CircleCI](https://circleci.com/gh/kamilkisiela/graphql-inspector.svg?style=shield&circle-token=d1cd06aba321ee2b7bf8bd2041104643639463b0)](https://circleci.com/gh/kamilkisiela/graphql-inspector) | ||
[![npm version](https://badge.fury.io/js/@graphql-inspector/cli.svg)](https://npmjs.com/package/@graphql-inspector/cli) | ||
|
||
**GraphQL Inspector** ouputs a list of changes between two GraphQL schemas. Every change is precisely explained and marked as breaking, non-breaking or dangerous. | ||
It helps you validate documents and fragments against a schema and even find similar or duplicated types. | ||
|
||
![Example](./demo.gif) | ||
|
||
## Features | ||
|
||
Major features: | ||
|
||
- **Compares schemas** | ||
- **Finds breaking or dangerous changes** | ||
- **Validates documents against a schema** | ||
- **Finds similar / duplicated types** | ||
- **Schema coverage based on documents** | ||
- **Serves a GraphQL server with faked data and GraphQL Playground** | ||
|
||
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. | ||
|
||
## Installation | ||
|
||
```bash | ||
yarn add @graphql-inspector/cli | ||
``` | ||
|
||
## CLI Usage | ||
|
||
```bash | ||
graphql-inspector diff <OLD_SCHEMA> <NEW_SCHEMA> | ||
graphql-inspector validate <DOCUMENTS> <SCHEMA> | ||
graphql-inspector similar <SCHEMA> | ||
graphql-inspector serve <SCHEMA> | ||
graphql-inspector coverage <DOCUMENTS> <SCHEMA> | ||
graphql-inspector --help | ||
``` | ||
|
||
### Examples | ||
|
||
```bash | ||
# Compare schemas | ||
$ graphql-inspector diff OLD_SCHEMA NEW_SCHEMA | ||
|
||
Detected the following changes (4) between schemas: | ||
|
||
🛑 Field `name` was removed from object type `Post` | ||
⚠️ Enum value `ARCHIVED` was added to enum `Status` | ||
✅ Field `createdAt` was added to object type `Post` | ||
|
||
Detected 1 breaking change | ||
|
||
|
||
# Validate documents | ||
$ graphql-inspector validate DOCUMENTS SCHEMA | ||
|
||
Detected 1 invalid document: | ||
|
||
🛑 ./documents/post.graphql: | ||
- Cannot query field createdAtSomePoint on type Post. Did you mean createdAt? | ||
|
||
|
||
# Find similar types | ||
$ graphql-inspector similar SCHEMA | ||
|
||
✅ Post | ||
Best match (60%): BlogPost | ||
|
||
|
||
# Serve faked GraphQL API with Playground | ||
$ graphql-inspector serve SCHEMA | ||
|
||
✅ Serving the GraphQL API on http://localhost:4000/ | ||
|
||
|
||
# Check coverage | ||
$ graphql-inspector coverage DOCUMENTS SCHEMA | ||
|
||
Schema coverage | ||
|
||
type Query { | ||
post x 1 | ||
} | ||
|
||
type Post { | ||
id x 1 | ||
title x 1 | ||
🛑 createdAt x 0 | ||
🛑 modifiedAt x 0 | ||
} | ||
|
||
``` | ||
|
||
## License | ||
|
||
[MIT](https://github.com/kamilkisiela/graphql-inspector/blob/master/LICENSE) © Kamil Kisiela |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes.
File renamed without changes.
Oops, something went wrong.