{
  "$ref": "#/definitions/Environment",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "definitions": {
    "Active": {
      "enum": [
        "dev",
        "development",
        "prod",
        "production",
        "test",
        "testing"
      ],
      "type": "string"
    },
    "App": {
      "additionalProperties": false,
      "properties": {
        "active": {
          "$ref": "#/definitions/Active",
          "description": "激活的配置文件"
        },
        "includes": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ],
          "description": "包含的配置文件"
        },
        "name": {
          "description": "应用名称",
          "type": "string"
        }
      },
      "type": "object"
    },
    "Appender": {
      "anyOf": [
        {
          "$ref": "#/definitions/CategoryFilterAppender"
        },
        {
          "$ref": "#/definitions/ConsoleAppender"
        },
        {
          "$ref": "#/definitions/FileAppender"
        },
        {
          "$ref": "#/definitions/SyncfileAppender"
        },
        {
          "$ref": "#/definitions/DateFileAppender"
        },
        {
          "$ref": "#/definitions/LogLevelFilterAppender"
        },
        {
          "$ref": "#/definitions/NoLogFilterAppender"
        },
        {
          "$ref": "#/definitions/MultiFileAppender"
        },
        {
          "$ref": "#/definitions/MultiprocessAppender"
        },
        {
          "$ref": "#/definitions/RecordingAppender"
        },
        {
          "$ref": "#/definitions/StandardErrorAppender"
        },
        {
          "$ref": "#/definitions/StandardOutputAppender"
        },
        {
          "$ref": "#/definitions/TCPAppender"
        },
        {
          "$ref": "#/definitions/CustomAppender"
        }
      ]
    },
    "AppenderModule": {
      "additionalProperties": false,
      "properties": {
        "configure": {
          "$comment": "(\n    config?: Config,\n    layouts?: LayoutsParam,\n    findAppender?: () => AppenderFunction,\n    levels?: Levels) => AppenderFunction",
          "properties": {
            "namedArgs": {
              "additionalProperties": false,
              "properties": {
                "config": {
                  "$ref": "#/definitions/Config"
                },
                "findAppender": {
                  "$comment": "() => AppenderFunction"
                },
                "layouts": {
                  "$ref": "#/definitions/LayoutsParam"
                },
                "levels": {
                  "$ref": "#/definitions/Levels"
                }
              },
              "type": "object"
            }
          },
          "type": "object"
        }
      },
      "required": [
        "configure"
      ],
      "type": "object"
    },
    "BasicLayout": {
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "basic",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "CategoryFilterAppender": {
      "additionalProperties": false,
      "description": "Category Filter",
      "properties": {
        "appender": {
          "type": "string"
        },
        "exclude": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "type": {
          "const": "categoryFilter",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "ColoredLayout": {
      "additionalProperties": false,
      "properties": {
        "type": {
          "enum": [
            "colored",
            "coloured"
          ],
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "Config": {},
    "ConsoleAppender": {
      "additionalProperties": false,
      "description": "Console Appender",
      "properties": {
        "layout": {
          "$ref": "#/definitions/Layout"
        },
        "type": {
          "const": "console",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "CustomAppender": {
      "properties": {
        "type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/definitions/AppenderModule"
            }
          ]
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "CustomLayout": {
      "properties": {
        "type": {
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "DataId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/definitions/DataObj"
        }
      ]
    },
    "DataObj": {
      "additionalProperties": false,
      "properties": {
        "group": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "type": {
          "$ref": "#/definitions/DataType",
          "default": "json"
        }
      },
      "required": [
        "id"
      ],
      "type": "object"
    },
    "DataType": {
      "enum": [
        "json",
        "yaml",
        "yml"
      ],
      "type": "string"
    },
    "DateFileAppender": {
      "additionalProperties": false,
      "properties": {
        "alwaysIncludePattern": {
          "type": "boolean"
        },
        "compress": {
          "type": "boolean"
        },
        "encoding": {
          "type": "string"
        },
        "fileNameSep": {
          "type": "string"
        },
        "filename": {
          "type": "string"
        },
        "flags": {
          "type": "string"
        },
        "keepFileExt": {
          "type": "boolean"
        },
        "layout": {
          "$ref": "#/definitions/Layout"
        },
        "mode": {
          "type": "number"
        },
        "numBackups": {
          "type": "number"
        },
        "pattern": {
          "description": "The following strings are recognised in the pattern:  - yyyy : the full year, use yy for just the last two digits  - MM   : the month  - dd   : the day of the month  - hh   : the hour of the day (24-hour clock)  - mm   : the minute of the hour  - ss   : seconds  - SSS  : milliseconds (although I'm not sure you'd want to roll your logs every millisecond)  - O    : timezone (capital letter o)",
          "type": "string"
        },
        "type": {
          "const": "dateFile",
          "type": "string"
        }
      },
      "required": [
        "type",
        "filename"
      ],
      "type": "object"
    },
    "DummyLayout": {
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "dummy",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "Environment": {
      "properties": {
        "app": {
          "$ref": "#/definitions/App"
        },
        "config": {
          "$ref": "#/definitions/VWebConfig",
          "description": "VWeb 相关配置"
        },
        "dependencies": {
          "description": "加载依赖",
          "items": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "object"
              }
            ]
          },
          "type": "array"
        },
        "logger": {
          "$ref": "#/definitions/LoggerConfig",
          "description": "日志配置信息 参考 log4js配置"
        },
        "modules": {
          "additionalProperties": {
            "anyOf": [
              {
                "properties": {
                  "require": {
                    "type": "string"
                  }
                },
                "type": "object"
              },
              {
                "const": false,
                "type": "boolean"
              }
            ]
          },
          "description": "vweb 模块配置信息 require 指定引入的模块",
          "type": "object"
        },
        "preloads": {
          "default": [],
          "description": "前置加载模块 越靠前 加载优先级越高",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "props": {
          "description": "应用配置信息",
          "type": "object"
        }
      },
      "type": "object"
    },
    "FileAppender": {
      "additionalProperties": false,
      "properties": {
        "backups": {
          "type": "number"
        },
        "compress": {
          "type": "boolean"
        },
        "encoding": {
          "type": "string"
        },
        "fileNameSep": {
          "type": "string"
        },
        "filename": {
          "type": "string"
        },
        "flags": {
          "type": "string"
        },
        "keepFileExt": {
          "type": "boolean"
        },
        "layout": {
          "$ref": "#/definitions/Layout"
        },
        "maxLogSize": {
          "type": [
            "number",
            "string"
          ]
        },
        "mode": {
          "type": "number"
        },
        "type": {
          "const": "file",
          "type": "string"
        }
      },
      "required": [
        "type",
        "filename"
      ],
      "type": "object"
    },
    "Layout": {
      "anyOf": [
        {
          "$ref": "#/definitions/BasicLayout"
        },
        {
          "$ref": "#/definitions/ColoredLayout"
        },
        {
          "$ref": "#/definitions/MessagePassThroughLayout"
        },
        {
          "$ref": "#/definitions/DummyLayout"
        },
        {
          "$ref": "#/definitions/PatternLayout"
        },
        {
          "$ref": "#/definitions/CustomLayout"
        }
      ]
    },
    "LayoutFunction": {
      "$comment": "(loggingEvent: LoggingEvent) => string",
      "properties": {
        "namedArgs": {
          "additionalProperties": false,
          "properties": {
            "loggingEvent": {
              "$ref": "#/definitions/LoggingEvent"
            }
          },
          "required": [
            "loggingEvent"
          ],
          "type": "object"
        }
      },
      "type": "object"
    },
    "LayoutsParam": {
      "additionalProperties": false,
      "properties": {
        "addLayout": {
          "$comment": "(name: string, serializerGenerator: LayoutFunction) => void",
          "properties": {
            "namedArgs": {
              "additionalProperties": false,
              "properties": {
                "name": {
                  "type": "string"
                },
                "serializerGenerator": {
                  "$ref": "#/definitions/LayoutFunction"
                }
              },
              "required": [
                "name",
                "serializerGenerator"
              ],
              "type": "object"
            }
          },
          "type": "object"
        },
        "basicLayout": {
          "$ref": "#/definitions/LayoutFunction"
        },
        "coloredLayout": {
          "$ref": "#/definitions/LayoutFunction"
        },
        "colouredLayout": {
          "$ref": "#/definitions/LayoutFunction"
        },
        "dummyLayout": {
          "$ref": "#/definitions/LayoutFunction"
        },
        "layout": {
          "$comment": "(name: string, config: PatternToken) => LayoutFunction",
          "properties": {
            "namedArgs": {
              "additionalProperties": false,
              "properties": {
                "config": {
                  "$ref": "#/definitions/PatternToken"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "config"
              ],
              "type": "object"
            }
          },
          "type": "object"
        },
        "messagePassThroughLayout": {
          "$ref": "#/definitions/LayoutFunction"
        },
        "patternLayout": {
          "$ref": "#/definitions/LayoutFunction"
        }
      },
      "required": [
        "basicLayout",
        "messagePassThroughLayout",
        "patternLayout",
        "colouredLayout",
        "coloredLayout",
        "dummyLayout",
        "addLayout",
        "layout"
      ],
      "type": "object"
    },
    "Level": {
      "additionalProperties": false,
      "properties": {
        "colour": {
          "type": "string"
        },
        "level": {
          "type": "number"
        },
        "levelStr": {
          "type": "string"
        }
      },
      "required": [
        "colour",
        "level",
        "levelStr"
      ],
      "type": "object"
    },
    "Levels": {
      "additionalProperties": false,
      "properties": {
        "ALL": {
          "$ref": "#/definitions/Level"
        },
        "DEBUG": {
          "$ref": "#/definitions/Level"
        },
        "ERROR": {
          "$ref": "#/definitions/Level"
        },
        "FATAL": {
          "$ref": "#/definitions/Level"
        },
        "INFO": {
          "$ref": "#/definitions/Level"
        },
        "MARK": {
          "$ref": "#/definitions/Level"
        },
        "OFF": {
          "$ref": "#/definitions/Level"
        },
        "TRACE": {
          "$ref": "#/definitions/Level"
        },
        "WARN": {
          "$ref": "#/definitions/Level"
        },
        "levels": {
          "items": {
            "$ref": "#/definitions/Level"
          },
          "type": "array"
        }
      },
      "required": [
        "ALL",
        "MARK",
        "TRACE",
        "DEBUG",
        "INFO",
        "WARN",
        "ERROR",
        "FATAL",
        "OFF",
        "levels"
      ],
      "type": "object"
    },
    "LogLevelFilterAppender": {
      "additionalProperties": false,
      "properties": {
        "appender": {
          "type": "string"
        },
        "level": {
          "type": "string"
        },
        "maxLevel": {
          "type": "string"
        },
        "type": {
          "const": "logLevelFilter",
          "type": "string"
        }
      },
      "required": [
        "type",
        "appender",
        "level"
      ],
      "type": "object"
    },
    "LoggerConfig": {
      "additionalProperties": false,
      "properties": {
        "appenders": {
          "additionalProperties": {
            "$ref": "#/definitions/Appender"
          },
          "type": "object"
        },
        "categories": {
          "additionalProperties": {
            "additionalProperties": false,
            "properties": {
              "appenders": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "enableCallStack": {
                "type": "boolean"
              },
              "level": {
                "type": "string"
              }
            },
            "required": [
              "appenders",
              "level"
            ],
            "type": "object"
          },
          "type": "object"
        },
        "disableClustering": {
          "type": "boolean"
        },
        "levels": {
          "$ref": "#/definitions/Levels"
        },
        "pm2": {
          "type": "boolean"
        },
        "pm2InstanceVar": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "LoggingEvent": {
      "additionalProperties": false,
      "properties": {
        "callStack": {
          "description": "The stack string after the skipped lines",
          "type": "string"
        },
        "categoryName": {
          "type": "string"
        },
        "cluster": {
          "additionalProperties": false,
          "properties": {
            "worker": {
              "type": "number"
            },
            "workerId": {
              "type": "number"
            }
          },
          "required": [
            "workerId",
            "worker"
          ],
          "type": "object"
        },
        "columnNumber": {
          "type": "number"
        },
        "context": {},
        "data": {
          "items": {},
          "type": "array"
        },
        "error": {
          "additionalProperties": false,
          "description": "The first Error object in the data if there is one",
          "properties": {
            "message": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "stack": {
              "type": "string"
            }
          },
          "required": [
            "name",
            "message"
          ],
          "type": "object"
        },
        "fileName": {
          "type": "string"
        },
        "functionName": {
          "type": "string"
        },
        "level": {
          "$ref": "#/definitions/Level"
        },
        "lineNumber": {
          "type": "number"
        },
        "pid": {
          "type": "number"
        },
        "startTime": {
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "categoryName",
        "level",
        "data",
        "startTime",
        "pid",
        "context"
      ],
      "type": "object"
    },
    "MessagePassThroughLayout": {
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "messagePassThrough",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "MultiFileAppender": {
      "additionalProperties": false,
      "properties": {
        "base": {
          "type": "string"
        },
        "extension": {
          "type": "string"
        },
        "property": {
          "type": "string"
        },
        "type": {
          "const": "multiFile",
          "type": "string"
        }
      },
      "required": [
        "type",
        "base",
        "property",
        "extension"
      ],
      "type": "object"
    },
    "MultiprocessAppender": {
      "additionalProperties": false,
      "properties": {
        "appender": {
          "type": "string"
        },
        "loggerHost": {
          "type": "string"
        },
        "loggerPort": {
          "type": "number"
        },
        "mode": {
          "enum": [
            "master",
            "worker"
          ],
          "type": "string"
        },
        "type": {
          "const": "multiprocess",
          "type": "string"
        }
      },
      "required": [
        "type",
        "mode"
      ],
      "type": "object"
    },
    "NacosConfig": {
      "additionalProperties": false,
      "properties": {
        "auth": {
          "additionalProperties": false,
          "description": "鉴权",
          "properties": {
            "accessToken": {
              "type": "string"
            },
            "authorization": {
              "type": "string"
            },
            "password": {
              "type": "string"
            },
            "username": {
              "type": "string"
            }
          },
          "type": "object"
        },
        "dataIds": {
          "anyOf": [
            {
              "$ref": "#/definitions/DataId"
            },
            {
              "items": {
                "$ref": "#/definitions/DataId"
              },
              "type": "array"
            }
          ],
          "description": "数据id"
        },
        "group": {
          "default": "DEFAULT_GROUP",
          "description": "配置组信息",
          "type": "string"
        },
        "namespace": {
          "default": "",
          "description": "nacos的命名空间",
          "type": "string"
        },
        "options": {
          "$ref": "#/definitions/NacosOptions",
          "description": "nacos的其他配置信息"
        },
        "serverAddr": {
          "description": "nacos的链接地址 eg: 127.0.0.1:8848    username:password@127.0.0.1:8848",
          "type": "string"
        },
        "type": {
          "$ref": "#/definitions/DataType",
          "description": "类型"
        }
      },
      "required": [
        "serverAddr",
        "namespace",
        "group",
        "dataIds"
      ],
      "type": "object"
    },
    "NacosOptions": {
      "additionalProperties": false,
      "properties": {
        "accessKey": {
          "type": "string"
        },
        "appName": {
          "type": "string"
        },
        "cacheDir": {
          "type": "string"
        },
        "clusterName": {
          "type": "string"
        },
        "contextPath": {
          "type": "string"
        },
        "decodeRes": {
          "$comment": "(res: any, method?: string, encoding?: string) => any",
          "properties": {
            "namedArgs": {
              "additionalProperties": false,
              "properties": {
                "encoding": {
                  "type": "string"
                },
                "method": {
                  "type": "string"
                },
                "res": {}
              },
              "required": [
                "res"
              ],
              "type": "object"
            }
          },
          "type": "object"
        },
        "defaultEncoding": {
          "type": "string"
        },
        "endpoint": {
          "type": "string"
        },
        "endpointQueryParams": {
          "type": "string"
        },
        "httpAgent": {},
        "httpOptions": {
          "description": "urllib RequestOptions"
        },
        "httpclient": {},
        "identityKey": {
          "type": "string"
        },
        "identityValue": {
          "type": "string"
        },
        "nameServerAddr": {
          "type": "string"
        },
        "namespace": {
          "type": "string"
        },
        "refreshInterval": {
          "type": "number"
        },
        "requestTimeout": {
          "type": "number"
        },
        "secretKey": {
          "type": "string"
        },
        "serverAddr": {
          "type": "string"
        },
        "serverPort": {
          "type": "number"
        },
        "ssl": {
          "type": "boolean"
        },
        "unit": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "NoLogFilterAppender": {
      "additionalProperties": false,
      "description": "No Log Filter",
      "properties": {
        "appender": {
          "type": "string"
        },
        "exclude": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "type": {
          "const": "noLogFilter",
          "type": "string"
        }
      },
      "required": [
        "type",
        "exclude",
        "appender"
      ],
      "type": "object"
    },
    "PatternLayout": {
      "additionalProperties": false,
      "properties": {
        "pattern": {
          "type": "string"
        },
        "tokens": {
          "additionalProperties": {
            "$ref": "#/definitions/Token"
          },
          "type": "object"
        },
        "type": {
          "const": "pattern",
          "type": "string"
        }
      },
      "required": [
        "type",
        "pattern"
      ],
      "type": "object"
    },
    "PatternToken": {
      "additionalProperties": false,
      "properties": {
        "pattern": {
          "type": "string"
        },
        "tokens": {
          "additionalProperties": {
            "$comment": "() => any"
          },
          "type": "object"
        }
      },
      "required": [
        "pattern",
        "tokens"
      ],
      "type": "object"
    },
    "RecordingAppender": {
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "recording",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "StandardErrorAppender": {
      "additionalProperties": false,
      "properties": {
        "layout": {
          "$ref": "#/definitions/Layout"
        },
        "type": {
          "const": "stderr",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "StandardOutputAppender": {
      "additionalProperties": false,
      "properties": {
        "layout": {
          "$ref": "#/definitions/Layout"
        },
        "type": {
          "const": "stdout",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "SyncfileAppender": {
      "additionalProperties": false,
      "properties": {
        "backups": {
          "type": "number"
        },
        "encoding": {
          "type": "string"
        },
        "filename": {
          "type": "string"
        },
        "flags": {
          "type": "string"
        },
        "layout": {
          "$ref": "#/definitions/Layout"
        },
        "maxLogSize": {
          "type": [
            "number",
            "string"
          ]
        },
        "mode": {
          "type": "number"
        },
        "type": {
          "const": "fileSync",
          "type": "string"
        }
      },
      "required": [
        "type",
        "filename"
      ],
      "type": "object"
    },
    "TCPAppender": {
      "additionalProperties": false,
      "description": "TCP Appender",
      "properties": {
        "endMsg": {
          "type": "string"
        },
        "host": {
          "type": "string"
        },
        "layout": {
          "$ref": "#/definitions/Layout"
        },
        "port": {
          "type": "number"
        },
        "type": {
          "const": "tcp",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "Token": {
      "anyOf": [
        {
          "$comment": "(logEvent: LoggingEvent) => string",
          "properties": {
            "namedArgs": {
              "additionalProperties": false,
              "properties": {
                "logEvent": {
                  "$ref": "#/definitions/LoggingEvent"
                }
              },
              "required": [
                "logEvent"
              ],
              "type": "object"
            }
          },
          "type": "object"
        },
        {
          "type": "string"
        }
      ]
    },
    "VWebConfig": {
      "properties": {
        "app": {
          "$ref": "#/definitions/App"
        },
        "debug": {
          "const": false,
          "description": "是否开启调试",
          "type": "boolean"
        },
        "exclude": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "format": "regex",
              "type": "string"
            },
            {
              "items": {
                "format": "regex",
                "type": "string"
              },
              "type": "array"
            }
          ],
          "description": "排除的文件"
        },
        "file": {
          "description": "类型为file时候启用",
          "type": "string"
        },
        "include": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "format": "regex",
              "type": "string"
            },
            {
              "items": {
                "format": "regex",
                "type": "string"
              },
              "type": "array"
            }
          ],
          "description": "包含的文件 eg: cache or *.js or *.ts"
        },
        "nacos": {
          "$ref": "#/definitions/NacosConfig",
          "description": "需指定类型为nacos"
        },
        "proxy": {
          "description": "需指定类型为proxy",
          "type": "string"
        },
        "src": {
          "description": "源码目录",
          "type": "string"
        },
        "type": {
          "default": true,
          "description": "配置类型",
          "enum": [
            "file",
            "nacos",
            "proxy"
          ],
          "type": "string"
        },
        "workdir": {
          "description": "项目加载目录 默认为当前项目 该属性用于调试框架中的异常问题",
          "type": "string"
        }
      },
      "type": "object"
    }
  }
}