{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$ref": "#/$defs/Settings",
  "$defs": {
    "Settings": {
      "type": "object",
      "properties": {
        "$schema": {
          "description": "For editors: https://docs.plotwork.dev/schemas/plotwork.config.json. Plotwork never fetches it.",
          "type": "string",
          "maxLength": 500
        },
        "defaults": {
          "$ref": "#/$defs/SettingsDefaults"
        },
        "rules": {
          "description": "Style rules the command line, the GitHub Action, and the drawing tools check.",
          "$ref": "#/$defs/RuleSet"
        },
        "brand": {
          "$ref": "#/$defs/SettingsBrand"
        },
        "sources": {
          "description": "Diagrams generated from files of the repository (Terraform, OpenAPI, Compose, schemas, and more), which plotwork generate and the GitHub Action keep in step with them.",
          "maxItems": 250,
          "type": "array",
          "items": {
            "$ref": "#/$defs/Source"
          }
        }
      },
      "additionalProperties": false,
      "description": "Repository settings: header defaults, style rules, the organisation whose brand hosted calls use, and the diagrams generated from files."
    },
    "SettingsDefaults": {
      "type": "object",
      "properties": {
        "icons": {
          "description": "icons= on every header that takes it: auto gives an item the icon its label names, off keeps items plain.",
          "type": "string",
          "enum": [
            "auto",
            "off"
          ]
        },
        "legend": {
          "description": "legend= on every header that takes it: off draws no legend of line roles.",
          "type": "string",
          "enum": [
            "on",
            "off"
          ]
        },
        "direction": {
          "description": "direction= on every header that takes this value.",
          "type": "string",
          "enum": [
            "auto",
            "right",
            "down",
            "left",
            "up"
          ]
        },
        "animate": {
          "description": "animate= on every header that takes it: on moves dashes along every line.",
          "type": "string",
          "enum": [
            "on",
            "off"
          ]
        },
        "numbered": {
          "description": "numbered= on every header that takes it: on numbers every line in the order written.",
          "type": "string",
          "enum": [
            "on",
            "off"
          ]
        },
        "theme": {
          "description": "The color scheme the command line and the GitHub Action draw a single picture in.",
          "type": "string",
          "enum": [
            "light",
            "dark",
            "auto"
          ]
        },
        "embedSource": {
          "description": "Write the source into every SVG the command line, the GitHub Action, and the drawing tools save.",
          "type": "boolean"
        },
        "schemes": {
          "description": "The pictures generate and sync write: light-and-dark (the default) writes <name>.svg and <name>.dark.svg; auto writes one <name>.svg that holds both and follows the reader's light or dark setting, so GitHub shows it right in either theme.",
          "type": "string",
          "enum": [
            "light-and-dark",
            "auto"
          ]
        },
        "kinds": {
          "description": "Header options for one kind, such as { \"mindmap\": { \"layout\": \"radial\" } }. A value the kind refuses is left out with warning S200.",
          "type": "object",
          "propertyNames": {
            "type": "string",
            "enum": [
              "flow",
              "sequence",
              "schema",
              "git",
              "gantt",
              "class",
              "state",
              "timeline",
              "journey",
              "mindmap",
              "treemap",
              "pie",
              "quadrant",
              "layers",
              "c4",
              "matrix",
              "sankey",
              "xychart",
              "tree",
              "swimlane"
            ]
          },
          "additionalProperties": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]*$"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          }
        }
      },
      "additionalProperties": false,
      "description": "Header options a diagram gets when its header does not set them."
    },
    "RuleSet": {
      "type": "object",
      "properties": {
        "level": {
          "type": "string",
          "enum": [
            "error",
            "warning"
          ],
          "description": "error fails a check; warning is reported and passes. Defaults to the file's level, which defaults to error."
        },
        "requireTitle": {
          "description": "Every diagram has a title in its header.",
          "type": "boolean"
        },
        "requireDescription": {
          "description": "Every diagram has desc= in its header, the text screen readers announce.",
          "type": "boolean"
        },
        "maxNodes": {
          "description": "The most nodes one diagram may hold.",
          "type": "integer",
          "minimum": 1,
          "maximum": 10000
        },
        "forbidKinds": {
          "description": "Kinds of diagram the team does not use.",
          "minItems": 1,
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "flow",
              "sequence",
              "schema",
              "git",
              "gantt",
              "class",
              "state",
              "timeline",
              "journey",
              "mindmap",
              "treemap",
              "pie",
              "quadrant",
              "layers",
              "c4",
              "matrix",
              "sankey",
              "xychart",
              "tree",
              "swimlane"
            ]
          }
        },
        "ids": {
          "description": "A pattern every node id must match.",
          "type": "object",
          "properties": {
            "pattern": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A JavaScript regular expression, without slashes, such as ^[a-z][a-z0-9_]*$. No nested repeats and no back references."
            },
            "kinds": {
              "minItems": 1,
              "maxItems": 20,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "flow",
                  "sequence",
                  "schema",
                  "git",
                  "gantt",
                  "class",
                  "state",
                  "timeline",
                  "journey",
                  "mindmap",
                  "treemap",
                  "pie",
                  "quadrant",
                  "layers",
                  "c4",
                  "matrix",
                  "sankey",
                  "xychart",
                  "tree",
                  "swimlane"
                ]
              },
              "description": "Only diagrams of these kinds; every kind when left out."
            },
            "hint": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300,
              "description": "What to tell the author who breaks the rule."
            },
            "level": {
              "type": "string",
              "enum": [
                "error",
                "warning"
              ],
              "description": "error fails a check; warning is reported and passes. Defaults to the file's level, which defaults to error."
            }
          },
          "required": [
            "pattern"
          ],
          "additionalProperties": false
        },
        "labels": {
          "description": "A pattern every node label must match.",
          "type": "object",
          "properties": {
            "pattern": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A JavaScript regular expression, without slashes, such as ^[a-z][a-z0-9_]*$. No nested repeats and no back references."
            },
            "kinds": {
              "minItems": 1,
              "maxItems": 20,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "flow",
                  "sequence",
                  "schema",
                  "git",
                  "gantt",
                  "class",
                  "state",
                  "timeline",
                  "journey",
                  "mindmap",
                  "treemap",
                  "pie",
                  "quadrant",
                  "layers",
                  "c4",
                  "matrix",
                  "sankey",
                  "xychart",
                  "tree",
                  "swimlane"
                ]
              },
              "description": "Only diagrams of these kinds; every kind when left out."
            },
            "hint": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300,
              "description": "What to tell the author who breaks the rule."
            },
            "level": {
              "type": "string",
              "enum": [
                "error",
                "warning"
              ],
              "description": "error fails a check; warning is reported and passes. Defaults to the file's level, which defaults to error."
            }
          },
          "required": [
            "pattern"
          ],
          "additionalProperties": false
        },
        "icons": {
          "description": "Icons required by label.",
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "description": "Matched against each node label with case ignored, such as postgres|mysql."
              },
              "use": {
                "minItems": 1,
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-z0-9-]+:(\\*|[a-z0-9][a-z0-9-]*)$"
                }
              },
              "kinds": {
                "minItems": 1,
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "flow",
                    "sequence",
                    "schema",
                    "git",
                    "gantt",
                    "class",
                    "state",
                    "timeline",
                    "journey",
                    "mindmap",
                    "treemap",
                    "pie",
                    "quadrant",
                    "layers",
                    "c4",
                    "matrix",
                    "sankey",
                    "xychart",
                    "tree",
                    "swimlane"
                  ]
                },
                "description": "Only diagrams of these kinds; every kind when left out."
              },
              "hint": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300,
                "description": "What to tell the author who breaks the rule."
              },
              "level": {
                "type": "string",
                "enum": [
                  "error",
                  "warning"
                ],
                "description": "error fails a check; warning is reported and passes. Defaults to the file's level, which defaults to error."
              }
            },
            "required": [
              "label",
              "use"
            ],
            "additionalProperties": false
          }
        },
        "tones": {
          "description": "Tones allowed or forbidden, by node type.",
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "types": {
                "minItems": 1,
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 40,
                  "pattern": "^[a-z][a-z0-9-]*$"
                },
                "description": "Only nodes of these types, as the kind names them (database, service, person, table, container); every node when left out."
              },
              "allow": {
                "minItems": 1,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "neutral",
                    "blue",
                    "violet",
                    "aqua",
                    "orange",
                    "green",
                    "amber",
                    "red"
                  ]
                }
              },
              "forbid": {
                "minItems": 1,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "neutral",
                    "blue",
                    "violet",
                    "aqua",
                    "orange",
                    "green",
                    "amber",
                    "red"
                  ]
                }
              },
              "kinds": {
                "minItems": 1,
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "flow",
                    "sequence",
                    "schema",
                    "git",
                    "gantt",
                    "class",
                    "state",
                    "timeline",
                    "journey",
                    "mindmap",
                    "treemap",
                    "pie",
                    "quadrant",
                    "layers",
                    "c4",
                    "matrix",
                    "sankey",
                    "xychart",
                    "tree",
                    "swimlane"
                  ]
                },
                "description": "Only diagrams of these kinds; every kind when left out."
              },
              "hint": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300,
                "description": "What to tell the author who breaks the rule."
              },
              "level": {
                "type": "string",
                "enum": [
                  "error",
                  "warning"
                ],
                "description": "error fails a check; warning is reported and passes. Defaults to the file's level, which defaults to error."
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false,
      "description": "A team's style rules for its Plotwork diagrams."
    },
    "SettingsBrand": {
      "type": "object",
      "properties": {
        "organization": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{1,64}$",
          "description": "The organisation's slug or id. Hosted calls by a member use its brand while its owner's plan includes brand themes."
        }
      },
      "required": [
        "organization"
      ],
      "additionalProperties": false,
      "description": "The organisation whose saved brand hosted calls use."
    },
    "Source": {
      "type": "object",
      "properties": {
        "name": {
          "description": "A short name for --source and the summary; the out path when left out.",
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$"
        },
        "from": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 300,
              "description": "A file, a folder, or a glob such as infra/**/*.tf, from the folder of the settings file. One that starts with ! leaves out what it matches."
            },
            {
              "minItems": 1,
              "maxItems": 20,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300,
                "description": "A file, a folder, or a glob such as infra/**/*.tf, from the folder of the settings file. One that starts with ! leaves out what it matches."
              }
            }
          ],
          "description": "The files to read: one pattern or a list."
        },
        "format": {
          "type": "string",
          "enum": [
            "sql",
            "prisma",
            "drizzle",
            "openapi",
            "terraform",
            "terraform-plan",
            "bicep",
            "arm",
            "pulumi",
            "cloudformation",
            "cdk",
            "compose",
            "kubernetes",
            "helm",
            "kustomize",
            "backstage",
            "structurizr",
            "asyncapi",
            "github-actions",
            "gitlab-ci",
            "azure-pipelines",
            "csv",
            "json",
            "tree",
            "git-log"
          ],
          "description": "The format of the files, as import_source reads them."
        },
        "out": {
          "type": "string",
          "minLength": 1,
          "maxLength": 300,
          "description": "The diagram to write: a .diagram file, or a Markdown file and the id of a ```diagram id=<id> fence in it."
        },
        "view": {
          "description": "openapi: endpoints, map, or sequence; git-log: git or timeline; structurizr: context, container, or component.",
          "type": "string",
          "enum": [
            "endpoints",
            "map",
            "sequence",
            "git",
            "timeline",
            "context",
            "container",
            "component"
          ]
        },
        "title": {
          "description": "The title of the diagram; the reader takes one from the files when left out.",
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "options": {
          "$ref": "#/$defs/SourceOptions"
        },
        "overrides": {
          "description": "The overrides file, applied after every import. Left out: the out path with .overrides.json in place of .diagram, or <file>.<fence id>.overrides.json beside a Markdown file.",
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        },
        "pictures": {
          "description": "For a .diagram out: also write its light and dark SVG beside it. On when left out.",
          "type": "boolean"
        },
        "schemes": {
          "description": "The pictures this source writes: light-and-dark writes <name>.svg and <name>.dark.svg; auto writes one <name>.svg that follows the reader's light or dark setting. defaults.schemes, then light-and-dark, when left out.",
          "type": "string",
          "enum": [
            "light-and-dark",
            "auto"
          ]
        },
        "publish": {
          "$ref": "#/$defs/SourcePublish"
        }
      },
      "required": [
        "from",
        "format",
        "out"
      ],
      "additionalProperties": false,
      "description": "One diagram generated from files of the repository and kept in step with them."
    },
    "SourceOptions": {
      "type": "object",
      "properties": {
        "operationId": {
          "description": "openapi with view sequence: the operation to draw.",
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "chart": {
          "description": "csv and json: the chart to draw.",
          "type": "string",
          "enum": [
            "auto",
            "xychart",
            "pie",
            "sankey",
            "treemap",
            "matrix"
          ]
        },
        "tables": {
          "description": "sql, prisma and drizzle: the tables to draw, each a name or a prefix ending in * (org_*).",
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "paths": {
          "description": "openapi: the path prefixes to read, such as /orders.",
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "tags": {
          "description": "openapi: the tags to read.",
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "groupBy": {
          "description": "terraform, bicep, arm, pulumi, cloudformation, cdk: module (the default) frames each module's resources and nests them by what they name; network nests by what they name alone; file (terraform) frames them by their .tf file; owner (backstage) frames a catalog by the group that owns each entity.",
          "type": "string",
          "enum": [
            "module",
            "network",
            "file",
            "owner"
          ]
        },
        "varFiles": {
          "description": "terraform: the variables files to apply, as -var-file would; bicep: the .bicepparam file; arm: the parameters file; pulumi: the Pulumi.<stack>.yaml file.",
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          }
        },
        "root": {
          "description": "terraform, bicep, pulumi, cloudformation, cdk: the root module, deployment, program, template, or stack to draw when the files hold several, such as envs/prod; each is a part of its own when left out. structurizr: the system or container the view is about.",
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        }
      },
      "additionalProperties": false,
      "description": "The reader options of one source, as import_source takes them."
    },
    "SourcePublish": {
      "type": "object",
      "properties": {
        "alias": {
          "description": "A stable link of a personal key: one address that always shows the latest version.",
          "type": "string",
          "minLength": 1,
          "maxLength": 60,
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "organization": {
          "description": "Publish into this organisation's library. Left out, with no alias, the organisation of brand.organization is used.",
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{1,64}$"
        },
        "folder": {
          "description": "The folder of the library to file it in, such as Platform/Infra.",
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        },
        "name": {
          "description": "Its name in the library; the diagram's title when left out.",
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "theme": {
          "description": "light, dark, or auto; defaults.theme, then light, when left out.",
          "type": "string",
          "enum": [
            "light",
            "dark",
            "auto"
          ]
        },
        "embedSource": {
          "description": "Write the diagram source into the hosted picture. Left out, it is not.",
          "type": "boolean"
        },
        "required": {
          "description": "Fail the run when this source cannot be published, such as with no key. Left out, a skipped publish is a notice.",
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "description": "Where the GitHub Action publishes a generated diagram when publish is on."
    }
  },
  "$id": "https://docs.plotwork.dev/schemas/plotwork.config.json",
  "title": "Plotwork repository settings"
}
