Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/octokit/graphql-schema
GitHub’s GraphQL Schema with validation. Automatically updated.
https://github.com/octokit/graphql-schema
generated graphql hacktoberfest octokit-js schema specification
Last synced: 2 days ago
JSON representation
GitHub’s GraphQL Schema with validation. Automatically updated.
- Host: GitHub
- URL: https://github.com/octokit/graphql-schema
- Owner: octokit
- License: mit
- Created: 2017-12-10T07:33:52.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2024-10-14T01:45:25.000Z (3 months ago)
- Last Synced: 2024-10-15T09:12:29.695Z (3 months ago)
- Topics: generated, graphql, hacktoberfest, octokit-js, schema, specification
- Language: JavaScript
- Homepage:
- Size: 15.4 MB
- Stars: 176
- Watchers: 9
- Forks: 62
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
- awesome-list - graphql-schema
README
# graphql-schema
> GitHub’s GraphQL Schema with validation. Automatically updated.
![Test](https://github.com/octokit/graphql-schema/workflows/Test/badge.svg)
## Usage
### Validation
```js
import { validate } from "@octokit/graphql-schema";
const errors = validate(`
{
viewer {
login
}
}
`);// errors is array. Contains errors if any
```You can also load the current Schema directly as JSON or [IDL](https://en.wikipedia.org/wiki/Interface_description_language).
```js
import { schema } from "@octokit/graphql-schema";
schema.json; // JSON version
schema.idl; // IDL version
```### Schema as Types
```ts
import { graphql } from "@octokit/graphql";
import { Repository } from "@octokit/graphql-schema";const { repository } = await graphql<{ repository: Repository }>(
`
{
repository(owner: "octokit", name: "graphql.js") {
issues(last: 3) {
edges {
node {
title
}
}
}
}
}
`,
{
headers: {
authorization: `token secret123`,
},
},
);
```## Local setup
```
git clone https://github.com/octokit/graphql-schema.git
cd graphql-schema
npm install
npm test
```Update schema files (`GITHUB_TOKEN` requires no scope)
```
GITHUB_TOKEN=... npm run update
```## See also
- [octokit/openapi](https://github.com/octokit/openapi) – GitHub's OpenAPI specification with `x-octokit` extension
- [octokit/webhooks](https://github.com/octokit/webhooks) – GitHub Webhooks specifications
- [octokit/app-permissions](https://github.com/octokit/app-permissions) – GitHub App permission specifications## LICENSE
[MIT](LICENSE.md)