Skip to content

Commit

Permalink
Rename package to gql-sdl
Browse files Browse the repository at this point in the history
mfw didn't check npm to see if gqlschema was a valid package name (it
would be, except there's a package that hasn't been updated in 4 years
called `gql-schema`). JavaScript ecosystem moment.
  • Loading branch information
jkmartindale committed May 24, 2022
1 parent 18da3a9 commit 8af7c99
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# gqlschema
# GraphQL Schema Downloader (gql-sdl)

CLI tool to pull the GraphQL schema (as GraphQL SDL or JSON) from a given endpoint with introspection enabled.
CLI tool to download the GraphQL schema (as GraphQL SDL or JSON) from a given API with introspection enabled.

This shouldn't have to be a standalone tool, but the state of GraphQL tooling is very unstable and I found myself unable to find a tool I could run just to get a remote GraphQL schema in SDL form. Every recommendation I found either:
This shouldn't have to be a standalone tool, but the state of GraphQL tooling is very unstable and I found myself unable to find a tool I could run just to get a remote GraphQL schema in the native schema definition language (SDL). Every recommendation I found either:
- Only returns JSON
- No longer works or isn't maintained
- Removed the schema download feature at some point
Expand All @@ -12,15 +12,15 @@ None of that makes sense, so I made this stupid script that does one thing and d

## Installation
```shell
npm install -g gqlschema
npm install -g gql-sdl
```

gqlschema is also compatible with `npx` if you prefer not to add it to your `PATH`.
gql-sdl is also compatible with `npx` if you prefer not to add it to your `PATH`.

## Usage
By default, gqlschema outputs the SDL to stdout:
By default, gql-sdl outputs the SDL to stdout:
```shell
$ gqlschema https://swapi-graphql.netlify.app/.netlify/functions/index
$ gql-sdl https://swapi-graphql.netlify.app/.netlify/functions/index
schema {
query: Root
}
Expand All @@ -39,10 +39,10 @@ Output can also be saved to a file with the `-o FILE` option. If you specify bot
Use the `-H HEADER` option to send headers (cookies, authorization, user agent, etc.) with the introspection query. For example, the GitHub GraphQL API requires a personal access token:
```shell
$ gqlschema https://api.github.com/graphql
$ gql-sdl https://api.github.com/graphql
Failed to connect to API endpoint.
HTTPError: Response code 401 (Unauthorized)
$ gqlschema https://api.github.com/graphql -H "Authorization: Bearer ghp_[redacted]"
$ gql-sdl https://api.github.com/graphql -H "Authorization: Bearer ghp_[redacted]"
directive @requiredCapabilities(requiredCapabilities: [String!]) on OBJECT | SCALAR | ARGUMENT_DEFINITION | INTERFACE | INPUT_OBJECT | FIELD_DEFINITION | ENUM | ENUM_VALUE | UNION | INPUT_FIELD_DEFINITION

"""Autogenerated input type of AbortQueuedMigrations"""
Expand All @@ -56,13 +56,13 @@ input AbortQueuedMigrationsInput {
...
```
gqlschema supports introspection options provided by [GraphQL.js](https://github.com/graphql/graphql-js). These flags may not be compatible with all GraphQL servers (especially `--specified-by-url` and `--input-value-deprecation`) and could cause the introspection to fail.
gql-sdl supports introspection options provided by [GraphQL.js](https://github.com/graphql/graphql-js). These flags may not be compatible with all GraphQL servers (especially `--specified-by-url` and `--input-value-deprecation`) and may cause the introspection query to fail.
### Full Usage
```
$ gqlschema --help
usage: index.js [-h] [-s] [-j] [-H HEADER] [-o FILE] [-N] [-D] [-R] [-S] [-I] endpoint
$ gql-sdl --help
usage: gql-sdl [-h] [-s] [-j] [-H HEADER] [-o FILE] [-N] [-D] [-R] [-S] [-I] endpoint

positional arguments:
endpoint GraphQL endpoint with introspection enabled
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "gqlschema",
"name": "gql-sdl",
"version": "1.0.0",
"description": "CLI tool to pull the GraphQL schema (as GraphQL SDL or JSON) from a given endpoint with introspection enabled",
"description": "CLI tool to download the GraphQL schema (as GraphQL SDL or JSON) from a given API with introspection enabled",
"keywords": [
"cli",
"graphql"
],
"homepage": "https://github.com/jkmartindale/gqlschema#readme",
"bugs": "https://github.com/jkmartindale/gqlschema/issues",
"homepage": "https://github.com/jkmartindale/gql-sdl#readme",
"bugs": "https://github.com/jkmartindale/gql-sdl/issues",
"license": "MIT",
"author": "James Martindale (https://twitter.com/jkmartindale)",
"files": [
Expand All @@ -16,9 +16,9 @@
],
"main": "dist/index.js",
"bin": {
"gqlschema": "dist/index.js"
"gql-sdl": "dist/index.js"
},
"repository": "github:jkmartindale/gqlschema",
"repository": "github:jkmartindale/gql-sdl",
"scripts": {
"build": "npx tsc",
"prepare": "npm run build",
Expand Down

0 comments on commit 8af7c99

Please sign in to comment.