{
    "$schema": "http://json-schema.org/draft-04/schema",
    "oneOf": [
        {
            "type": "object",
            "properties": {
                "graph": {
                    "$ref": "#/definitions/graph"
                }
            },
            "additionalProperties": false,
            "required": [
                "graph"
            ]
        },
        {
            "type": "object",
            "properties": {
                "label": {
                    "type": "string"
                },
                "type": {
                    "type": "string"
                },
                "metadata": {
                    "type": [
                        "object",
                        "null"
                    ]
                },
                "graphs": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/graph"
                    }
                }
            },
            "additionalProperties": false
        }
    ],
    "definitions": {
        "graph": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "label": {
                    "type": "string"
                },
                "directed": {
                    "type": [
                        "boolean",
                        "null"
                    ],
                    "default": true
                },
                "type": {
                    "type": "string"
                },
                "metadata": {
                    "type": [
                        "object",
                        "null"
                    ]
                },
                "nodes": {
                    "type": [
                        "array",
                        "null"
                    ],
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "label": {
                                "type": "string"
                            },
                            "metadata": {
                                "type": [
                                    "object",
                                    "null"
                                ]
                            }
                        },
                        "required": [
                            "id"
                        ]
                    }
                },
                "edges": {
                    "type": [
                        "array",
                        "null"
                    ],
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "source": {
                                "type": "string"
                            },
                            "target": {
                                "type": "string"
                            },
                            "relation": {
                                "type": "string"
                            },
                            "directed": {
                                "type": [
                                    "boolean",
                                    "null"
                                ],
                                "default": true
                            },
                            "label": {
                                "type": "string"
                            },
                            "metadata": {
                                "type": [
                                    "object",
                                    "null"
                                ]
                            }
                        },
                        "required": [
                            "source",
                            "target"
                        ]
                    }
                }
            }
        }
    }
}
