Jam3/adviser

View on GitHub
src/core/config/data/config-file-schema.json

Summary

Maintainability
Test Coverage
{
  "title": "Adviser Config File Schema",
  "description": "Use to validate user's adviser configuration files",
  "type": "object",
  "definitions": {
    "rule-str": {
      "type": "string",
      "enum": ["off", "warn", "error"]
    },
    "rule-num": {
      "type": "number",
      "minimum": 0,
      "maximum": 2
    }
  },
  "properties": {
    "plugins": {
      "type": ["array"],
      "items": {
        "type": "string"
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "extends": {
      "type": ["array"],
      "items": {
        "type": "string"
      }
    },
    "settings": {
      "type": "object",
      "properties": {
        "tags": {
          "type": "object",
          "additionalProperties": {
            "type": ["array"],
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "rules": {
      "type": "object",
      "minProperties": 1,
      "patternProperties": {
        ".*": {
          "anyOf": [
            { "$ref": "#/definitions/rule-str" },
            { "$ref": "#/definitions/rule-num" },
            {
              "type": ["array"],
              "items": [
                {
                  "anyOf": [{ "$ref": "#/definitions/rule-str" }, { "$ref": "#/definitions/rule-num" }]
                },
                {
                  "type": "object"
                }
              ],
              "additionalItems": false
            }
          ]
        }
      }
    }
  },
  "required": ["rules"]
}