Skip to content

Instantly share code, notes, and snippets.

@SerafimArts
Created November 16, 2019 21:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SerafimArts/f2028c7d38740ca3f2c42773bd2b72d8 to your computer and use it in GitHub Desktop.
Save SerafimArts/f2028c7d38740ca3f2c42773bd2b72d8 to your computer and use it in GitHub Desktop.
A GraphQL introspection JSON Schema
{
"$id": "graphql/introspection",
"description": "A JSON Schema for checking GraphQL introspection",
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"__schema": {
"type": "object",
"properties": {
"queryType": {
"$ref": "#/definitions/schemaField"
},
"mutationType": {
"$ref": "#/definitions/schemaField"
},
"subscriptionType": {
"$ref": "#/definitions/schemaField"
},
"types": {
"type": "array",
"items": {
"$ref": "#/definitions/type"
}
},
"directives": {
"type": "array",
"items": {
"$ref": "#/definitions/directive"
}
}
}
}
},
"required": [
"__schema"
]
},
"errors": {
"type": "array"
},
"extensions": {
"type": "object"
}
},
"additionalProperties": false,
"required": [
"data"
],
"definitions": {
"schemaField": {
"anyOf": [
{
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "null"
}
]
},
"type": {
"type": "object",
"properties": {
"kind": {
"$ref": "#/definitions/kind"
},
"name": {
"type": "string"
},
"description": {
"$ref": "#/definitions/description"
},
"fields": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/field"
}
},
{
"type": "null"
}
]
},
"inputFields": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/inputField"
}
},
{
"type": "null"
}
]
},
"interfaces": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/interface"
}
},
{
"type": "null"
}
]
},
"enumValues": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/enumValue"
}
},
{
"type": "null"
}
]
},
"possibleTypes": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/possibleType"
}
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"argument": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"description": {
"$ref": "#/definitions/description"
},
"type": {
"$ref": "#/definitions/typeOf"
},
"defaultValue": {
"anyOf": [
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
},
{
"type": "null"
},
{
"type": "number"
},
{
"type": "object"
}
]
}
}
},
"field": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"description": {
"$ref": "#/definitions/description"
},
"args": {
"type": "array",
"items": {
"$ref": "#/definitions/argument"
}
},
"type": {
"$ref": "#/definitions/typeOf"
},
"isDeprecated": {
"type": "boolean"
},
"deprecationReason": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
}
},
"inputField": {
"type": "object"
},
"interface": {
"type": "object"
},
"enumValue": {
"type": "object"
},
"possibleType": {
"type": "object"
},
"kind": {
"type": "string",
"enum": [
"SCALAR",
"OBJECT",
"INTERFACE",
"UNION",
"ENUM",
"INPUT_OBJECT",
"LIST",
"NON_NULL"
]
},
"typeOf": {
"anyOf": [
{
"type": "object",
"properties": {
"kind": {
"$ref": "#/definitions/kind"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"ofType": {
"$ref": "#/definitions/typeOf"
}
}
},
{
"type": "null"
}
]
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"location": {
"type": "string",
"enum": [
"QUERY",
"MUTATION",
"SUBSCRIPTION",
"FIELD",
"FRAGMENT_DEFINITION",
"FRAGMENT_SPREAD",
"INLINE_FRAGMENT",
"SCHEMA",
"SCALAR",
"OBJECT",
"FIELD_DEFINITION",
"ARGUMENT_DEFINITION",
"INTERFACE",
"UNION",
"ENUM",
"ENUM_VALUE",
"INPUT_OBJECT",
"INPUT_FIELD_DEFINITION"
]
},
"directive": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"description": {
"$ref": "#/definitions/description"
},
"locations": {
"type": "array",
"items": {
"$ref": "#/definitions/location"
}
},
"args": {
"type": "array",
"items": {
"$ref": "#/definitions/argument"
}
},
"isRepeatable": {
"type": "boolean"
}
},
"additionalProperties": false
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment