Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cosad3s/graphql-introspection-converter
Simple converter for GraphQL introspection JSON to schema
https://github.com/cosad3s/graphql-introspection-converter
graphql
Last synced: 12 days ago
JSON representation
Simple converter for GraphQL introspection JSON to schema
- Host: GitHub
- URL: https://github.com/cosad3s/graphql-introspection-converter
- Owner: cosad3s
- License: gpl-3.0
- Created: 2023-03-28T11:48:42.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-28T12:13:27.000Z (almost 2 years ago)
- Last Synced: 2024-10-29T21:11:09.148Z (2 months ago)
- Topics: graphql
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GraphQL Introspection Converter
Simple converter for GraphQL introspection JSON to schema (SDL).
## Configuration
```bash
npm install
```## Usage
```bash
node index.js /path/to/introspection.json
```The generated SDL schema will be generated in current folder under a name like `schema-*.graphql`.
## Credits
Thanks to:
- [https://github.com/graphql/graphql-js](https://github.com/graphql/graphql-js).
- [https://github.com/mstachniuk/graphql-schema-from-introspection-generator](https://github.com/mstachniuk/graphql-schema-from-introspection-generator)## Tips
**Generate queries, mutations ... from schema:**
With [gql-generator](https://github.com/timqian/gql-generator):
```bash
gqlg --schemaFilePath ./schema-1680004349192.graphql --destDirPath ./output/
```**Introspection query:**
```js
{__schema{queryType{name}mutationType{name}subscriptionType{name}types{...FullType}directives{name description locations args{...InputValue}}}}fragment FullType on __Type{kind name description fields(includeDeprecated:true){name description args{...InputValue}type{...TypeRef}isDeprecated deprecationReason}inputFields{...InputValue}interfaces{...TypeRef}enumValues(includeDeprecated:true){name description isDeprecated deprecationReason}possibleTypes{...TypeRef}}fragment InputValue on __InputValue{name description type{...TypeRef}defaultValue}fragment TypeRef on __Type{kind name ofType{kind name ofType{kind name ofType{kind name ofType{kind name ofType{kind name ofType{kind name ofType{kind name}}}}}}}}
```