{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://paulkov.github.io/dpone/schemas/gitops/test-manifest.schema.json",
  "title": "dpone GitOps hermetic test manifest",
  "type": "object",
  "required": [
    "kind",
    "pipeline",
    "input",
    "expect"
  ],
  "additionalProperties": false,
  "properties": {
    "kind": {
      "const": "dpone.test.v1"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "pipeline": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "not": {
        "pattern": "^(?:/|[A-Za-z]:|.*\\\\)"
      }
    },
    "process": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "input": {
      "$ref": "#/$defs/input"
    },
    "expect": {
      "$ref": "#/$defs/expect"
    },
    "limits": {
      "$ref": "#/$defs/limits"
    }
  },
  "$defs": {
    "input": {
      "type": "object",
      "required": [
        "fixture"
      ],
      "additionalProperties": false,
      "properties": {
        "fixture": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024,
          "not": {
            "pattern": "^(?:/|[A-Za-z]:|.*\\\\)"
          }
        },
        "format": {
          "const": "jsonl",
          "default": "jsonl"
        },
        "initial_target": {
          "type": "object",
          "required": [
            "fixture"
          ],
          "additionalProperties": false,
          "properties": {
            "fixture": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024,
              "not": {
                "pattern": "^(?:/|[A-Za-z]:|.*\\\\)"
              }
            }
          }
        }
      }
    },
    "expect": {
      "type": "object",
      "required": [
        "rows"
      ],
      "additionalProperties": false,
      "properties": {
        "rows": {
          "type": "integer",
          "minimum": 0,
          "maximum": 20000
        },
        "rejected_rows": {
          "const": 0,
          "default": 0
        },
        "schema": {
          "type": "object",
          "maxProperties": 1000,
          "additionalProperties": {
            "enum": [
              "null",
              "bool",
              "int64",
              "float64",
              "string",
              "array",
              "object",
              "mixed"
            ]
          }
        },
        "output_fixture": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024,
          "not": {
            "pattern": "^(?:/|[A-Za-z]:|.*\\\\)"
          }
        },
        "match": {
          "const": "exact_unordered"
        }
      },
      "dependentRequired": {
        "match": [
          "output_fixture"
        ]
      }
    },
    "limits": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "max_bytes": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10485760,
          "default": 10485760
        },
        "max_rows": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10000,
          "default": 10000
        },
        "max_line_bytes": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1048576,
          "default": 1048576
        },
        "timeout_seconds": {
          "type": "integer",
          "minimum": 1,
          "maximum": 300,
          "default": 30
        }
      }
    }
  }
}
