{
    "$ref": "#/definitions/AntVSpec",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "definitions": {
        "Aggregate": {
            "enum": [
                "count",
                "sum",
                "min",
                "max"
            ],
            "type": "string"
        },
        "Annotation": {
            "anyOf": [
                {
                    "additionalProperties": false,
                    "properties": {
                        "content": {
                            "type": "string"
                        },
                        "position": {
                            "type": "object"
                        },
                        "style": {
                            "type": "object"
                        },
                        "type": {
                            "const": "text",
                            "type": "string"
                        }
                    },
                    "required": [
                        "type",
                        "position",
                        "content"
                    ],
                    "type": "object"
                },
                {
                    "additionalProperties": false,
                    "properties": {
                        "end": {},
                        "position": {
                            "type": "object"
                        },
                        "start": {},
                        "style": {
                            "type": "object"
                        },
                        "type": {
                            "const": "line",
                            "type": "string"
                        }
                    },
                    "required": [
                        "type",
                        "position",
                        "style"
                    ],
                    "type": "object"
                },
                {
                    "additionalProperties": false,
                    "properties": {
                        "position": {
                            "type": "object"
                        },
                        "style": {
                            "type": "object"
                        },
                        "type": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "type",
                        "position",
                        "style"
                    ],
                    "type": "object"
                }
            ]
        },
        "AntVSpec": {
            "anyOf": [
                {
                    "additionalProperties": false,
                    "properties": {
                        "$schema": {
                            "description": "URL of the schema",
                            "type": "string"
                        },
                        "basis": {
                            "$ref": "#/definitions/ChartBasis"
                        },
                        "component": {
                            "$ref": "#/definitions/Component",
                            "description": "Components definition such as Annotation"
                        },
                        "data": {
                            "$ref": "#/definitions/ChartDataDef"
                        },
                        "interactions": {
                            "items": {
                                "$ref": "#/definitions/Interaction"
                            },
                            "type": "array"
                        },
                        "layer": {
                            "items": {
                                "$ref": "#/definitions/ChartLayer"
                            },
                            "type": "array"
                        }
                    },
                    "required": [
                        "basis",
                        "data",
                        "layer"
                    ],
                    "type": "object"
                },
                {
                    "additionalProperties": false,
                    "properties": {
                        "$schema": {
                            "description": "URL of the schema",
                            "type": "string"
                        },
                        "basis": {
                            "$ref": "#/definitions/GraphBasis"
                        },
                        "component": {
                            "$ref": "#/definitions/Component",
                            "description": "Components definition such as Annotation"
                        },
                        "data": {
                            "$ref": "#/definitions/GraphDataDef"
                        },
                        "interactions": {
                            "items": {
                                "$ref": "#/definitions/Interaction"
                            },
                            "type": "array"
                        },
                        "layer": {
                            "items": {
                                "$ref": "#/definitions/GraphLayer"
                            },
                            "type": "array"
                        },
                        "layout": {
                            "$ref": "#/definitions/Layout"
                        }
                    },
                    "required": [
                        "basis",
                        "data",
                        "layer",
                        "layout"
                    ],
                    "type": "object"
                }
            ]
        },
        "Axis": {
            "additionalProperties": false,
            "properties": {
                "domain": {
                    "description": "whether to draw the domain line of the axis",
                    "type": "boolean"
                },
                "label": {
                    "$ref": "#/definitions/AxisLabelConfig",
                    "description": "label of the axis"
                },
                "max": {
                    "description": "max of the axis",
                    "type": "number"
                },
                "min": {
                    "description": "min of the axis",
                    "type": "number"
                },
                "position": {
                    "description": "direction of the axis, top | bottom | left | right",
                    "type": "string"
                },
                "tickInterval": {
                    "description": "interval of the ticks in the axis",
                    "type": "number"
                },
                "ticks": {
                    "description": "whether to show ticks in the axis",
                    "type": "boolean"
                },
                "title": {
                    "$ref": "#/definitions/AxisTitleConfig",
                    "description": "title of the axis"
                },
                "top": {
                    "description": "whether draw the axis on the top of the layer",
                    "type": "boolean"
                }
            },
            "type": "object"
        },
        "AxisLabelConfig": {
            "additionalProperties": false,
            "properties": {
                "angle": {
                    "type": "number"
                },
                "autoEllipsis": {
                    "type": "boolean"
                },
                "autoHide": {
                    "type": "boolean"
                },
                "autoRotate": {
                    "type": "boolean"
                },
                "formatter": {},
                "offset": {
                    "type": "number"
                }
            },
            "type": "object"
        },
        "AxisTitleConfig": {
            "additionalProperties": false,
            "properties": {
                "position": {
                    "type": "string"
                },
                "text": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "Bin": {
            "enum": [
                true,
                false
            ],
            "type": "boolean"
        },
        "ChartBasis": {
            "additionalProperties": false,
            "properties": {
                "height": {
                    "description": "vis's height",
                    "minimum": 0,
                    "type": "number"
                },
                "padding": {
                    "anyOf": [
                        {
                            "items": {
                                "type": "number"
                            },
                            "type": "array"
                        },
                        {
                            "type": "number"
                        },
                        {
                            "const": "auto",
                            "type": "string"
                        }
                    ],
                    "description": "vis's padding"
                },
                "type": {
                    "const": "chart",
                    "description": "indicate what kind of visualization this spec is about",
                    "type": "string"
                },
                "width": {
                    "description": "vis's width",
                    "minimum": 0,
                    "type": "number"
                }
            },
            "required": [
                "type"
            ],
            "type": "object"
        },
        "ChartDataDef": {
            "anyOf": [
                {
                    "$ref": "#/definitions/ChartInlineData"
                },
                {
                    "$ref": "#/definitions/ChartOnlineData"
                }
            ]
        },
        "ChartEncoding": {
            "additionalProperties": false,
            "properties": {
                "color": {
                    "$ref": "#/definitions/Color"
                },
                "column": {
                    "$ref": "#/definitions/Column"
                },
                "row": {
                    "$ref": "#/definitions/Row"
                },
                "size": {
                    "$ref": "#/definitions/Size"
                },
                "theta": {
                    "$ref": "#/definitions/Theta"
                },
                "x": {
                    "$ref": "#/definitions/X"
                },
                "y": {
                    "$ref": "#/definitions/Y"
                }
            },
            "type": "object"
        },
        "ChartInlineData": {
            "additionalProperties": false,
            "properties": {
                "type": {
                    "const": "json-array",
                    "type": "string"
                },
                "values": {
                    "items": {
                        "$ref": "#/definitions/DataRow"
                    },
                    "type": "array"
                }
            },
            "required": [
                "values"
            ],
            "type": "object"
        },
        "ChartLayer": {
            "additionalProperties": false,
            "properties": {
                "encoding": {
                    "$ref": "#/definitions/ChartEncoding"
                },
                "mark": {
                    "$ref": "#/definitions/ChartMarkDef"
                }
            },
            "required": [
                "mark",
                "encoding"
            ],
            "type": "object"
        },
        "ChartMarkDef": {
            "anyOf": [
                {
                    "$ref": "#/definitions/ChartMarkType"
                },
                {
                    "additionalProperties": false,
                    "properties": {
                        "interpolate": {
                            "const": "step",
                            "description": "for `line` and `area` only TODO: 'step' is used in AVA but more interpolate type can be defined",
                            "type": "string"
                        },
                        "style": {
                            "additionalProperties": false,
                            "description": "Mark style configuration",
                            "properties": {
                                "color": {
                                    "$ref": "#/definitions/ColorCfg"
                                },
                                "fillColor": {
                                    "$ref": "#/definitions/ColorCfg"
                                },
                                "fillOpacity": {
                                    "type": "number"
                                },
                                "innerRadius": {
                                    "type": "number"
                                },
                                "lineWidth": {
                                    "type": "number"
                                },
                                "opacity": {
                                    "type": "number"
                                },
                                "shape": {
                                    "type": "string"
                                },
                                "size": {
                                    "type": "number"
                                },
                                "strokeColor": {
                                    "$ref": "#/definitions/ColorCfg"
                                },
                                "strokeOpacity": {
                                    "type": "number"
                                },
                                "strokeWidth": {
                                    "type": "number"
                                }
                            },
                            "type": "object"
                        },
                        "type": {
                            "$ref": "#/definitions/ChartMarkType"
                        }
                    },
                    "required": [
                        "type"
                    ],
                    "type": "object"
                }
            ],
            "description": "Mark definition for `Chart` type visualization"
        },
        "ChartMarkType": {
            "enum": [
                "bar",
                "line",
                "arc",
                "area",
                "point",
                "rect"
            ],
            "type": "string"
        },
        "ChartOnlineData": {
            "additionalProperties": false,
            "properties": {
                "config": {
                    "additionalProperties": false,
                    "description": "config for parsing data",
                    "properties": {
                        "delimiter": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "format": {
                    "description": "type of the data, for correctly parsing",
                    "enum": [
                        "csv",
                        "json"
                    ],
                    "type": "string"
                },
                "type": {
                    "const": "url",
                    "type": "string"
                },
                "values": {
                    "description": "URL of the data source.",
                    "type": "string"
                }
            },
            "required": [
                "values"
            ],
            "type": "object"
        },
        "Color": {
            "additionalProperties": false,
            "properties": {
                "aggregate": {
                    "$ref": "#/definitions/Aggregate"
                },
                "field": {
                    "type": "string"
                },
                "scale": {
                    "$ref": "#/definitions/Scale"
                },
                "type": {
                    "$ref": "#/definitions/EType"
                }
            },
            "required": [
                "type"
            ],
            "type": "object"
        },
        "ColorCfg": {
            "type": "string"
        },
        "Column": {
            "additionalProperties": false,
            "properties": {
                "field": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/EType"
                }
            },
            "required": [
                "field",
                "type"
            ],
            "type": "object"
        },
        "Component": {
            "additionalProperties": false,
            "properties": {
                "annotations": {
                    "items": {
                        "$ref": "#/definitions/Annotation"
                    },
                    "type": "array"
                }
            },
            "type": "object"
        },
        "DataRow": {
            "type": "object"
        },
        "EType": {
            "enum": [
                "quantitative",
                "temporal",
                "ordinal",
                "nominal"
            ],
            "type": "string"
        },
        "GraphBasis": {
            "additionalProperties": false,
            "properties": {
                "height": {
                    "description": "vis's height",
                    "minimum": 0,
                    "type": "number"
                },
                "padding": {
                    "anyOf": [
                        {
                            "items": {
                                "type": "number"
                            },
                            "type": "array"
                        },
                        {
                            "type": "number"
                        },
                        {
                            "const": "auto",
                            "type": "string"
                        }
                    ],
                    "description": "vis's padding"
                },
                "type": {
                    "const": "graph",
                    "description": "indicate what kind of visualization this spec is about",
                    "type": "string"
                },
                "width": {
                    "description": "vis's width",
                    "minimum": 0,
                    "type": "number"
                }
            },
            "required": [
                "type"
            ],
            "type": "object"
        },
        "GraphData": {
            "type": "object"
        },
        "GraphDataDef": {
            "anyOf": [
                {
                    "$ref": "#/definitions/GraphInlineData"
                },
                {
                    "$ref": "#/definitions/GraphOnlineData"
                }
            ]
        },
        "GraphInlineData": {
            "additionalProperties": false,
            "properties": {
                "type": {
                    "const": "json",
                    "description": "type of `values`",
                    "type": "string"
                },
                "values": {
                    "$ref": "#/definitions/GraphData"
                }
            },
            "required": [
                "values"
            ],
            "type": "object"
        },
        "GraphLayer": {
            "additionalProperties": false,
            "properties": {
                "links": {
                    "additionalProperties": false,
                    "properties": {
                        "encoding": {
                            "$ref": "#/definitions/LinkEncoding"
                        },
                        "mark": {
                            "$ref": "#/definitions/LinkMarkDef"
                        }
                    },
                    "required": [
                        "mark",
                        "encoding"
                    ],
                    "type": "object"
                },
                "nodes": {
                    "additionalProperties": false,
                    "properties": {
                        "encoding": {
                            "$ref": "#/definitions/NodeEncoding"
                        },
                        "mark": {
                            "$ref": "#/definitions/NodeMarkDef"
                        }
                    },
                    "required": [
                        "mark",
                        "encoding"
                    ],
                    "type": "object"
                }
            },
            "required": [
                "nodes",
                "links"
            ],
            "type": "object"
        },
        "GraphOnlineData": {
            "additionalProperties": false,
            "properties": {
                "format": {
                    "const": "json",
                    "description": "type of the data, for correctly parsing",
                    "type": "string"
                },
                "type": {
                    "const": "url",
                    "type": "string"
                },
                "values": {
                    "description": "URL of the data source.",
                    "type": "string"
                }
            },
            "required": [
                "values"
            ],
            "type": "object"
        },
        "Interaction": {
            "additionalProperties": false,
            "properties": {
                "type": {
                    "type": "string"
                }
            },
            "required": [
                "type"
            ],
            "type": "object"
        },
        "Layout": {
            "additionalProperties": false,
            "properties": {
                "links": {
                    "description": "the field name used to map links in the `json` type data",
                    "type": "string"
                },
                "nodes": {
                    "description": "the field name used to map nodes in the `json` type data",
                    "type": "string"
                },
                "options": {
                    "description": "layout detail configurations",
                    "type": "object"
                },
                "type": {
                    "description": "layout type",
                    "enum": [
                        "random",
                        "radial",
                        "mds",
                        "circular",
                        "fruchterman",
                        "force",
                        "gForce",
                        "dagre",
                        "concentric",
                        "grid",
                        "forceAtlas2"
                    ],
                    "type": "string"
                }
            },
            "required": [
                "type",
                "nodes",
                "links"
            ],
            "type": "object"
        },
        "LinkEncoding": {
            "additionalProperties": false,
            "properties": {
                "color": {
                    "$ref": "#/definitions/Color"
                },
                "size": {
                    "$ref": "#/definitions/Size"
                }
            },
            "type": "object"
        },
        "LinkMarkDef": {
            "anyOf": [
                {
                    "$ref": "#/definitions/LinkMarkType"
                },
                {
                    "additionalProperties": false,
                    "properties": {
                        "style": {
                            "additionalProperties": false,
                            "description": "Mark style configuration",
                            "properties": {
                                "color": {
                                    "$ref": "#/definitions/ColorCfg"
                                },
                                "fillColor": {
                                    "$ref": "#/definitions/ColorCfg"
                                },
                                "fillOpacity": {
                                    "type": "number"
                                },
                                "innerRadius": {
                                    "type": "number"
                                },
                                "lineWidth": {
                                    "type": "number"
                                },
                                "opacity": {
                                    "type": "number"
                                },
                                "shape": {
                                    "type": "string"
                                },
                                "size": {
                                    "type": "number"
                                },
                                "strokeColor": {
                                    "$ref": "#/definitions/ColorCfg"
                                },
                                "strokeOpacity": {
                                    "type": "number"
                                },
                                "strokeWidth": {
                                    "type": "number"
                                }
                            },
                            "type": "object"
                        },
                        "type": {
                            "$ref": "#/definitions/LinkMarkType"
                        }
                    },
                    "required": [
                        "type"
                    ],
                    "type": "object"
                }
            ],
            "description": "Mark definition for link of `Graph` type visualization"
        },
        "LinkMarkType": {
            "enum": [
                "line"
            ],
            "type": "string"
        },
        "NodeEncoding": {
            "additionalProperties": false,
            "properties": {
                "color": {
                    "$ref": "#/definitions/Color"
                },
                "size": {
                    "$ref": "#/definitions/Size"
                },
                "theta": {
                    "$ref": "#/definitions/Theta"
                }
            },
            "type": "object"
        },
        "NodeMarkDef": {
            "anyOf": [
                {
                    "$ref": "#/definitions/NodeMarkType"
                },
                {
                    "additionalProperties": false,
                    "properties": {
                        "style": {
                            "additionalProperties": false,
                            "description": "Mark style configuration",
                            "properties": {
                                "color": {
                                    "$ref": "#/definitions/ColorCfg"
                                },
                                "fillColor": {
                                    "$ref": "#/definitions/ColorCfg"
                                },
                                "fillOpacity": {
                                    "type": "number"
                                },
                                "innerRadius": {
                                    "type": "number"
                                },
                                "lineWidth": {
                                    "type": "number"
                                },
                                "opacity": {
                                    "type": "number"
                                },
                                "shape": {
                                    "type": "string"
                                },
                                "size": {
                                    "type": "number"
                                },
                                "strokeColor": {
                                    "$ref": "#/definitions/ColorCfg"
                                },
                                "strokeOpacity": {
                                    "type": "number"
                                },
                                "strokeWidth": {
                                    "type": "number"
                                }
                            },
                            "type": "object"
                        },
                        "type": {
                            "$ref": "#/definitions/NodeMarkType"
                        }
                    },
                    "required": [
                        "type"
                    ],
                    "type": "object"
                }
            ],
            "description": "Mark definition for node of `Graph` type visualization"
        },
        "NodeMarkType": {
            "enum": [
                "point",
                "arc",
                "rect"
            ],
            "type": "string"
        },
        "Row": {
            "additionalProperties": false,
            "properties": {
                "field": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/EType"
                }
            },
            "required": [
                "field",
                "type"
            ],
            "type": "object"
        },
        "Scale": {
            "additionalProperties": false,
            "properties": {
                "domain": {
                    "items": {
                        "type": "number"
                    },
                    "type": "array"
                },
                "domainMin": {
                    "type": "number"
                },
                "domaminMax": {
                    "type": "number"
                },
                "range": {
                    "items": {
                        "type": [
                            "string",
                            "number"
                        ]
                    },
                    "type": "array"
                },
                "rangeMax": {
                    "type": [
                        "string",
                        "number"
                    ]
                },
                "rangeMin": {
                    "type": [
                        "string",
                        "number"
                    ]
                }
            },
            "type": "object"
        },
        "Size": {
            "additionalProperties": false,
            "properties": {
                "aggregate": {
                    "$ref": "#/definitions/Aggregate"
                },
                "field": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/EType"
                }
            },
            "required": [
                "field",
                "type"
            ],
            "type": "object"
        },
        "Stack": {
            "enum": [
                true,
                false,
                "zero",
                "normalize"
            ],
            "type": [
                "boolean",
                "string"
            ]
        },
        "Theta": {
            "additionalProperties": false,
            "properties": {
                "aggregate": {
                    "$ref": "#/definitions/Aggregate"
                },
                "field": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/EType"
                }
            },
            "required": [
                "type"
            ],
            "type": "object"
        },
        "X": {
            "additionalProperties": false,
            "properties": {
                "aggregate": {
                    "$ref": "#/definitions/Aggregate"
                },
                "axis": {
                    "$ref": "#/definitions/Axis"
                },
                "bin": {
                    "$ref": "#/definitions/Bin"
                },
                "field": {
                    "description": "field can be optional once the aggregation type is `count`",
                    "type": "string"
                },
                "stack": {
                    "$ref": "#/definitions/Stack"
                },
                "type": {
                    "$ref": "#/definitions/EType"
                }
            },
            "required": [
                "type"
            ],
            "type": "object"
        },
        "Y": {
            "additionalProperties": false,
            "properties": {
                "aggregate": {
                    "$ref": "#/definitions/Aggregate",
                    "description": "aggregate and bin cannot be declared together"
                },
                "axis": {
                    "$ref": "#/definitions/Axis"
                },
                "bin": {
                    "$ref": "#/definitions/Bin"
                },
                "field": {
                    "description": "field can be optional once the aggregation type is `count`",
                    "type": "string"
                },
                "stack": {
                    "$ref": "#/definitions/Stack"
                },
                "type": {
                    "$ref": "#/definitions/EType"
                }
            },
            "required": [
                "type"
            ],
            "type": "object"
        }
    }
}
