{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "properties": {
        "version": {
            "type": "number",
            "const": 1
        },
        "models": {
            "$ref": "#/definitions/SchemaModels"
        },
        "nonModels": {
            "$ref": "#/definitions/SchemaNonModels"
        },
        "enums": {
            "$ref": "#/definitions/SchemaEnums"
        },
        "queries": {
            "$ref": "#/definitions/SchemaQueries"
        },
        "mutations": {
            "$ref": "#/definitions/SchemaMutations"
        },
        "subscriptions": {
            "$ref": "#/definitions/SchemaSubscriptions"
        },
        "inputs": {
            "$ref": "#/definitions/SchemaInputs"
        },
        "generations": {
            "$ref": "#/definitions/SchemaGenerations"
        },
        "conversations": {
            "$ref": "#/definitions/SchemaConversationRoutes"
        }
    },
    "required": [
        "version",
        "models",
        "nonModels",
        "enums"
    ],
    "additionalProperties": false,
    "description": "Root Schema Representation",
    "definitions": {
        "SchemaModels": {
            "$ref": "#/definitions/Record%3Cstring%2CSchemaModel%3E",
            "description": "Top-level Entities on a Schema"
        },
        "Record<string,SchemaModel>": {
            "type": "object",
            "additionalProperties": {
                "$ref": "#/definitions/SchemaModel"
            }
        },
        "SchemaModel": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "attributes": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/ModelAttribute"
                    }
                },
                "fields": {
                    "$ref": "#/definitions/Fields"
                },
                "pluralName": {
                    "type": "string"
                },
                "syncable": {
                    "type": "boolean"
                },
                "primaryKeyInfo": {
                    "$ref": "#/definitions/PrimaryKeyInfo"
                }
            },
            "required": [
                "name",
                "fields",
                "pluralName",
                "primaryKeyInfo"
            ],
            "additionalProperties": false
        },
        "ModelAttribute": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string"
                },
                "properties": {
                    "type": "object"
                }
            },
            "required": [
                "type"
            ],
            "additionalProperties": false
        },
        "Fields": {
            "$ref": "#/definitions/Record%3Cstring%2CField%3E",
            "description": "Field Definition"
        },
        "Record<string,Field>": {
            "type": "object",
            "additionalProperties": {
                "$ref": "#/definitions/Field"
            }
        },
        "Field": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/FieldType"
                },
                "isArray": {
                    "type": "boolean"
                },
                "isRequired": {
                    "type": "boolean"
                },
                "isReadOnly": {
                    "type": "boolean"
                },
                "isArrayNullable": {
                    "type": "boolean"
                },
                "attributes": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/FieldAttribute"
                    }
                },
                "association": {
                    "$ref": "#/definitions/AssociationType"
                },
                "arguments": {
                    "$ref": "#/definitions/Arguments"
                }
            },
            "required": [
                "name",
                "type",
                "isArray",
                "isRequired"
            ],
            "additionalProperties": false
        },
        "FieldType": {
            "anyOf": [
                {
                    "$ref": "#/definitions/ScalarType"
                },
                {
                    "type": "object",
                    "properties": {
                        "enum": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "enum"
                    ],
                    "additionalProperties": false
                },
                {
                    "type": "object",
                    "properties": {
                        "model": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "model"
                    ],
                    "additionalProperties": false
                },
                {
                    "type": "object",
                    "properties": {
                        "nonModel": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "nonModel"
                    ],
                    "additionalProperties": false
                }
            ]
        },
        "ScalarType": {
            "type": "string",
            "enum": [
                "ID",
                "String",
                "Int",
                "Float",
                "AWSDate",
                "AWSTime",
                "AWSDateTime",
                "AWSTimestamp",
                "AWSEmail",
                "AWSURL",
                "AWSIPAddress",
                "Boolean",
                "AWSJSON",
                "AWSPhone"
            ]
        },
        "FieldAttribute": {
            "$ref": "#/definitions/ModelAttribute"
        },
        "AssociationType": {
            "anyOf": [
                {
                    "$ref": "#/definitions/AssociationHasMany"
                },
                {
                    "$ref": "#/definitions/AssociationHasOne"
                },
                {
                    "$ref": "#/definitions/AssociationBelongsTo"
                }
            ]
        },
        "AssociationHasMany": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "connectionType": {
                    "$ref": "#/definitions/CodeGenConnectionType"
                },
                "associatedWith": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [
                "associatedWith",
                "connectionType"
            ]
        },
        "CodeGenConnectionType": {
            "type": "string",
            "enum": [
                "HAS_ONE",
                "BELONGS_TO",
                "HAS_MANY"
            ],
            "description": "Field-level Relationship Definitions"
        },
        "AssociationHasOne": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "connectionType": {
                    "$ref": "#/definitions/CodeGenConnectionType"
                },
                "associatedWith": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "targetNames": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [
                "associatedWith",
                "connectionType",
                "targetNames"
            ]
        },
        "AssociationBelongsTo": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "connectionType": {
                    "$ref": "#/definitions/CodeGenConnectionType"
                },
                "targetNames": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [
                "connectionType",
                "targetNames"
            ]
        },
        "Arguments": {
            "$ref": "#/definitions/Record%3Cstring%2CArgument%3E"
        },
        "Record<string,Argument>": {
            "type": "object",
            "additionalProperties": {
                "$ref": "#/definitions/Argument"
            }
        },
        "Argument": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/InputFieldType"
                },
                "isArray": {
                    "type": "boolean"
                },
                "isRequired": {
                    "type": "boolean"
                },
                "isArrayNullable": {
                    "type": "boolean"
                }
            },
            "required": [
                "name",
                "type",
                "isArray",
                "isRequired"
            ],
            "additionalProperties": false
        },
        "InputFieldType": {
            "anyOf": [
                {
                    "$ref": "#/definitions/ScalarType"
                },
                {
                    "type": "object",
                    "properties": {
                        "enum": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "enum"
                    ],
                    "additionalProperties": false
                },
                {
                    "type": "object",
                    "properties": {
                        "input": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "input"
                    ],
                    "additionalProperties": false
                }
            ]
        },
        "PrimaryKeyInfo": {
            "type": "object",
            "properties": {
                "isCustomPrimaryKey": {
                    "type": "boolean"
                },
                "primaryKeyFieldName": {
                    "type": "string"
                },
                "sortKeyFieldNames": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [
                "isCustomPrimaryKey",
                "primaryKeyFieldName",
                "sortKeyFieldNames"
            ],
            "additionalProperties": false
        },
        "SchemaNonModels": {
            "$ref": "#/definitions/Record%3Cstring%2CSchemaNonModel%3E"
        },
        "Record<string,SchemaNonModel>": {
            "type": "object",
            "additionalProperties": {
                "$ref": "#/definitions/SchemaNonModel"
            }
        },
        "SchemaNonModel": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "fields": {
                    "$ref": "#/definitions/Fields"
                }
            },
            "required": [
                "name",
                "fields"
            ],
            "additionalProperties": false
        },
        "SchemaEnums": {
            "$ref": "#/definitions/Record%3Cstring%2CSchemaEnum%3E"
        },
        "Record<string,SchemaEnum>": {
            "type": "object",
            "additionalProperties": {
                "$ref": "#/definitions/SchemaEnum"
            }
        },
        "SchemaEnum": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "values": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [
                "name",
                "values"
            ],
            "additionalProperties": false
        },
        "SchemaQueries": {
            "$ref": "#/definitions/Record%3Cstring%2CSchemaQuery%3E"
        },
        "Record<string,SchemaQuery>": {
            "type": "object",
            "additionalProperties": {
                "$ref": "#/definitions/SchemaQuery"
            }
        },
        "SchemaQuery": {
            "$ref": "#/definitions/Pick%3CField%2C(%22name%22%7C%22type%22%7C%22isArray%22%7C%22isRequired%22%7C%22isArrayNullable%22%7C%22arguments%22)%3E"
        },
        "Pick<Field,(\"name\"|\"type\"|\"isArray\"|\"isRequired\"|\"isArrayNullable\"|\"arguments\")>": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/FieldType"
                },
                "isArray": {
                    "type": "boolean"
                },
                "isRequired": {
                    "type": "boolean"
                },
                "isArrayNullable": {
                    "type": "boolean"
                },
                "arguments": {
                    "$ref": "#/definitions/Arguments"
                }
            },
            "required": [
                "name",
                "type",
                "isArray",
                "isRequired"
            ],
            "additionalProperties": false
        },
        "SchemaMutations": {
            "$ref": "#/definitions/Record%3Cstring%2CSchemaMutation%3E"
        },
        "Record<string,SchemaMutation>": {
            "type": "object",
            "additionalProperties": {
                "$ref": "#/definitions/SchemaMutation"
            }
        },
        "SchemaMutation": {
            "$ref": "#/definitions/SchemaQuery"
        },
        "SchemaSubscriptions": {
            "$ref": "#/definitions/Record%3Cstring%2CSchemaSubscription%3E"
        },
        "Record<string,SchemaSubscription>": {
            "type": "object",
            "additionalProperties": {
                "$ref": "#/definitions/SchemaSubscription"
            }
        },
        "SchemaSubscription": {
            "$ref": "#/definitions/SchemaQuery"
        },
        "SchemaInputs": {
            "$ref": "#/definitions/Record%3Cstring%2CInput%3E"
        },
        "Record<string,Input>": {
            "type": "object",
            "additionalProperties": {
                "$ref": "#/definitions/Input"
            }
        },
        "Input": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "attributes": {
                    "$ref": "#/definitions/Arguments"
                }
            },
            "required": [
                "name",
                "attributes"
            ],
            "additionalProperties": false,
            "description": "Input Definition"
        },
        "SchemaGenerations": {
            "$ref": "#/definitions/SchemaQueries"
        },
        "SchemaConversationRoutes": {
            "$ref": "#/definitions/Record%3Cstring%2CSchemaConversationRoute%3E"
        },
        "Record<string,SchemaConversationRoute>": {
            "type": "object",
            "additionalProperties": {
                "$ref": "#/definitions/SchemaConversationRoute"
            }
        },
        "SchemaConversationRoute": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "models": {
                    "$ref": "#/definitions/SchemaModels"
                },
                "nonModels": {
                    "$ref": "#/definitions/SchemaNonModels"
                },
                "enums": {
                    "$ref": "#/definitions/SchemaEnums"
                },
                "conversation": {
                    "$ref": "#/definitions/SchemaConversation"
                },
                "message": {
                    "$ref": "#/definitions/SchemaConversationMessage"
                }
            },
            "required": [
                "name",
                "models",
                "nonModels",
                "enums",
                "conversation",
                "message"
            ],
            "additionalProperties": false
        },
        "SchemaConversation": {
            "type": "object",
            "properties": {
                "modelName": {
                    "type": "string"
                }
            },
            "required": [
                "modelName"
            ],
            "additionalProperties": false
        },
        "SchemaConversationMessage": {
            "type": "object",
            "properties": {
                "modelName": {
                    "type": "string"
                },
                "subscribe": {
                    "$ref": "#/definitions/SchemaSubscription"
                },
                "send": {
                    "$ref": "#/definitions/SchemaMutation"
                }
            },
            "required": [
                "modelName",
                "subscribe",
                "send"
            ],
            "additionalProperties": false
        }
    }
}
