CARVIEW |
Select Language
HTTP/2 200
date: Fri, 10 Oct 2025 15:46:21 GMT
server: Fly/6f91d33b9d (2025-10-08)
content-type: text/html; charset=utf-8
content-encoding: gzip
via: 2 fly.io, 2 fly.io
fly-request-id: 01K77CTG0G8C9R7A4D1MZQFE7D-bom
get-graphql-schema | Simon Willison’s TILs
get-graphql-schema
The GraphQL schema language is a concise way to represent the available schema provided by a GraphQL endpoint. It looks something like this:
type assets {
url: String
node_id: String
name: String
label: String
content_type: String
state: String
created_at: String
updated_at: String
browser_download_url: String
id: Int
size: Int
download_count: Int
uploader: users
release: releases
}
type assetsCollection {
totalCount: Int
pageInfo: PageInfo
nodes: [assets]
edges: [assetsEdge]
}
You can retrieve a JSON version of this from the GraphQL server itself using the query at the bottom of this document.
But... if you want it back in readable text as shown above, you can use the get-graphql-schema tool. Run that like this:
npx get-graphql-schema https://github-to-sqlite.dogsheep.net/graphql
If the API requires authentication, use the --header
option like this:
npx get-graphql-schema https://api.github.com/graphql -h 'Authorization=Bearer XXX'
Retrieving the schema as JSON using GraphQL
I found this query using the network inspector against a GraphiQL instance (https://api.fly.io/graphql) that offered a "Schema" tab:
query IntrospectionQuery {
__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
}
}
}
}
}
}
}
}
Related
- fly Using the undocumented Fly GraphQL API - 2022-01-21
- graphql GraphQL fragments - 2022-09-30
- github Accessing repository dependencies in the GitHub GraphQL API - 2020-04-30
- graphql Using curl to run GraphQL queries from the command line - 2022-02-21
- github Searching for repositories by topic using the GitHub GraphQL API - 2020-10-09
- gpt3 Generating OpenAPI specifications using GPT-3 - 2022-11-13
- github Bulk fetching repository details with the GitHub GraphQL API - 2021-01-17
- github-actions Using the GitHub Actions cache with npx and no package.json - 2022-03-22
- clickhouse Querying the GitHub archive with the ClickHouse playground - 2022-12-31
- npm Annotated package.json for idb-keyval - 2022-02-10
Created 2022-02-01T14:55:44-08:00, updated 2022-02-05T11:49:00-08:00 · History · Edit