more README stuff, example README, other misc cleanup

This commit is contained in:
Ben Kraft
2020-01-16 17:56:13 -08:00
parent 2c3702e282
commit 35699a73ef
7 changed files with 52 additions and 3 deletions
+28 -1
View File
@@ -1,7 +1,34 @@
Generate the schemas by getting a token from [GitHub](https://github.com/settings/tokens/new) (no scopes needed), then:
# example of genql
## Getting a token
Get a token from [GitHub](https://github.com/settings/tokens/new) (no scopes needed).
## Invoking the example
To run the example:
```sh
$ KEY=<your token> go run ./cmd/example/main.go <username>
you are Ben Kraft
csilvers is Craig Silverstein
```
## Running genql
It's already checked in to github, but to generate `generated.go`:
```sh
rm example/generated.go
go run ./cmd/genql/main.go example/genql.yaml
```
## Generating the schema files
These are also checked in, but to update them:
```sh
npm install -g graphql-introspection-json-to-sdl
curl -H "Authorization: bearer <your token>" https://api.github.com/graphql >example/schema.json
graphql-introspection-json-to-sdl example/schema.json >example/schema.graphql
```
TODO: something better
+1
View File
@@ -1,3 +1,4 @@
// Code generated by github.com/Khan/genql, DO NOT EDIT.
package example
import (
+5
View File
@@ -0,0 +1,5 @@
# These are the defaults.
package: example
schema: schema.graphql
queries: queries.graphql
generated: generated.go