{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ouroboros.dev/schemas/approval-form.schema.json",
  "title": "自定义审批表单描述",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "formatVersion",
    "name",
    "title",
    "fields"
  ],
  "properties": {
    "formatVersion": {
      "type": "integer",
      "const": 1
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "pattern": "^(?!.*\\.\\.)(?!.*[\\s/\\\\]).+$"
    },
    "title": {
      "type": "string",
      "pattern": "\\S"
    },
    "description": {
      "type": "string"
    },
    "fields": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/field"
      }
    }
  },
  "$defs": {
    "field": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "label",
        "type"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "pattern": "^(?!__)[A-Za-z_][A-Za-z0-9_]*$"
        },
        "label": {
          "type": "string",
          "pattern": "\\S"
        },
        "description": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "pattern": "\\S",
          "description": "现有字段类型目录的名称，按应用上下文解析；可扩展，不枚举内置类型。"
        },
        "params": {
          "type": "object",
          "description": "字段类型参数；规则和默认值由对应字段类型编译器处理。"
        }
      }
    }
  }
}
