{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/tach-domain/latest.json",
  "title": "Tach Domain Configuration Schema",
  "description": "Domain-level configuration for the Tach CLI",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/gauge-sh/tach/refs/heads/main/public/tach-domain-toml-schema.json",
    "sourceSha256": "e48b40b7f4ef16c8b655213c3276708ef28d39a3c11c4c062c6b6c8f560c05b6",
    "fileMatch": [
      "tach.domain.toml"
    ],
    "parsers": [
      "toml"
    ]
  },
  "type": "object",
  "properties": {
    "root": {
      "type": "object",
      "properties": {
        "depends_on": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "string",
                "description": "Path to the dependency"
              },
              {
                "type": "object",
                "required": [
                  "path"
                ],
                "properties": {
                  "path": {
                    "type": "string",
                    "description": "Path to the dependency"
                  },
                  "deprecated": {
                    "type": "boolean",
                    "default": false,
                    "description": "Flag usages of this dependency without failing tach check"
                  }
                }
              }
            ]
          },
          "default": null,
          "description": "List of dependencies for the module"
        },
        "cannot_depend_on": {
          "type": "array",
          "items": {
            "type": "string",
            "description": "Path to the dependency"
          },
          "default": null,
          "description": "List of forbidden dependencies for the module"
        },
        "layer": {
          "type": "string",
          "description": "The architectural layer this module belongs to"
        },
        "unchecked": {
          "type": "boolean",
          "default": false,
          "description": "Flag to skip checks for this module"
        },
        "utility": {
          "type": "boolean",
          "description": "Whether this module is a utility module"
        },
        "strict": {
          "type": "boolean",
          "default": false,
          "description": "DEPRECATED: Use 'interfaces' instead"
        },
        "visibility": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": null,
          "description": "List of visibility patterns"
        }
      },
      "description": "Configuration for the root module of the domain",
      "additionalProperties": false
    },
    "modules": {
      "type": "array",
      "items": {
        "type": "object",
        "oneOf": [
          {
            "required": [
              "path"
            ],
            "properties": {
              "path": {
                "type": "string",
                "description": "Path to the module"
              },
              "depends_on": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "string",
                      "description": "Path to the dependency"
                    },
                    {
                      "type": "object",
                      "required": [
                        "path"
                      ],
                      "properties": {
                        "path": {
                          "type": "string",
                          "description": "Path to the dependency"
                        },
                        "deprecated": {
                          "type": "boolean",
                          "default": false,
                          "description": "Flag usages of this dependency without failing tach check"
                        }
                      },
                      "additionalProperties": false
                    }
                  ]
                },
                "default": null,
                "description": "List of dependencies for the module"
              },
              "cannot_depend_on": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Path to the dependency"
                },
                "default": null,
                "description": "List of forbidden dependencies for the module"
              },
              "depends_on_external": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Path to the dependency"
                },
                "default": null,
                "description": "List of external dependencies for the module"
              },
              "cannot_depend_on_external": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Path to the dependency"
                },
                "default": null,
                "description": "List of forbidden external dependencies for the module"
              },
              "layer": {
                "type": "string",
                "description": "The architectural layer this module belongs to"
              },
              "unchecked": {
                "type": "boolean",
                "default": false,
                "description": "Flag to skip checks for this module"
              },
              "utility": {
                "type": "boolean",
                "description": "Whether this module is a utility module"
              },
              "strict": {
                "type": "boolean",
                "default": false,
                "description": "DEPRECATED: Use 'interfaces' instead"
              },
              "visibility": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "default": null,
                "description": "List of visibility patterns"
              }
            },
            "additionalProperties": false,
            "type": "object"
          },
          {
            "required": [
              "paths"
            ],
            "properties": {
              "paths": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "List of module paths that share the same configuration"
              },
              "depends_on": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "string",
                      "description": "Path to the dependency"
                    },
                    {
                      "type": "object",
                      "required": [
                        "path"
                      ],
                      "properties": {
                        "path": {
                          "type": "string",
                          "description": "Path to the dependency"
                        },
                        "deprecated": {
                          "type": "boolean",
                          "default": false,
                          "description": "Flag usages of this dependency without failing tach check"
                        }
                      },
                      "additionalProperties": false
                    }
                  ]
                },
                "default": null,
                "description": "List of dependencies for the module"
              },
              "cannot_depend_on": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Path to the dependency"
                },
                "default": null,
                "description": "List of forbidden dependencies for the module"
              },
              "depends_on_external": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Path to the dependency"
                },
                "default": null,
                "description": "List of external dependencies for the module"
              },
              "cannot_depend_on_external": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Path to the dependency"
                },
                "default": null,
                "description": "List of forbidden external dependencies for the module"
              },
              "layer": {
                "type": "string",
                "description": "The architectural layer this module belongs to"
              },
              "unchecked": {
                "type": "boolean",
                "default": false,
                "description": "Flag to skip checks for this module"
              },
              "utility": {
                "type": "boolean",
                "description": "Whether this module is a utility module"
              },
              "strict": {
                "type": "boolean",
                "default": false,
                "description": "DEPRECATED: Use 'interfaces' instead"
              },
              "visibility": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "default": null,
                "description": "List of visibility patterns"
              }
            },
            "additionalProperties": false,
            "type": "object"
          }
        ]
      },
      "default": [],
      "description": "List of module configurations"
    },
    "interfaces": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "expose": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of regex patterns that match paths to expose in this interface"
          },
          "from": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of regex patterns that match modules which adopt this interface"
          },
          "visibility": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "default": null,
            "description": "List of visibility patterns"
          },
          "exclusive": {
            "type": "boolean",
            "default": false,
            "description": "Whether this interface is exclusive"
          },
          "data_types": {
            "type": "string",
            "default": "all",
            "description": "The data types allowed to cross the interface"
          }
        },
        "additionalProperties": false
      },
      "default": [],
      "description": "List of interface configurations"
    }
  },
  "additionalProperties": false
}
