{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "http://clang.llvm.org/docs/JSONCompilationDatabase.html!",
    "title": "Compilation Database",
    "description": "List of compilation commands, that specify each translation unit in a project",
    "type": "array",
    "items": {
        "$ref": "#/definitions/commandObject"
    },
    "definitions": {
        "commandObject": {
            "description": "Compilation command for single translation unit",
            "type": "object",
            "properties": {
                "directory": {
                    "description": "Working directory of the compilation",
                    "type": "string",
                    "minLength": 1,
                    "examples": [
                        "/home/user"
                    ]
                },
                "file": {
                    "description": "Main translation unit source processed by this compilation command",
                    "type": "string",
                    "minLength": 1,
                    "examples": [
                        "main.cpp"
                    ]
                },
                "command": {
                    "description": "Compilation command",
                    "type": "string",
                    "minLength": 1,
                    "examples": [
                        "/usr/bin/gcc main.cpp"
                    ]
                },
                "arguments": {
                    "description": "Compilation command as list of strings",
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "type": "string",
                        "minLength": 1
                    },
                    "examples": [
                        [
                            "/usr/bin/gcc",
                            "main.cpp"
                        ]
                    ]
                },
                "output": {
                    "description": "Name of the output created by this compilation command",
                    "type": "string"
                }
            },
            "required": [
                "directory",
                "file"
            ],
            "anyOf": [
                {
                    "required": [
                        "command"
                    ]
                },
                {
                    "required": [
                        "arguments"
                    ]
                }
            ]
        }
    }
}