{
  "$defs": {
    "testgroup": {
      "type": "object",
      "title": "Test Group",
      "description": "A test group",
      "properties": {
        "data": {
          "description": "Commands or dictionaries defining the testdata in this testgroup",
          "oneOf": [
            {
              "type": "array",
              "items": {
                "allOf": [
                  {
                    "$ref": "#/$defs/data_dict"
                  },
                  {
                    "type": "object",
                    "maxProperties": 1
                  }
                ]
              }
            },
            {
              "$ref": "#/$defs/data_dict"
            }
          ]
        },
        "include": {
          "title": "Inclusion",
          "type": "array",
          "description": "Test cases and test groups to be included in this testgroup from elsewhere.",
          "items": {
            "type": "string"
          }
        },
        "testdata.yaml": {
          "$ref": "#/$defs/testdata_settings"
        },
        "solution": {
          "$ref": "#/$defs/solution"
        }
      },
      "additionalProperties": false
    },
    "testdata_settings": {
      "type": "object",
      "title": "Testdata settings",
      "description": "The settings that apply to the testdata for this test group. Will be copied to this testgroup's `testdata.yaml`.",
      "properties": {
        "on_reject": {
          "enum": ["break", "continue"],
          "default": "break"
        },
        "grading": {
          "enum": ["default", "custom"]
        },
        "grader_flags": {
          "type": "string",
          "examples": ["min", "sum"]
        },
        "input_validator_flags": {
          "type": "string"
        },
        "accept_score": {
          "type": "string"
        },
        "reject_score": {
          "type": "string"
        },
        "range": {
          "type": "string"
        }
      }
    },
    "data_dict": {
      "title": "Data Dictionary",
      "description": "Defines the contents of a test group",
      "type": "object",
      "patternProperties": {
        "^([A-Za-z0-9][A-Za-z0-9_-]*[A-Za-z0-9]|[A-Za-z0-9]|)$": {
          "oneOf": [
            {
              "$ref": "#/$defs/testgroup"
            },
            {
              "$ref": "#/$defs/testcase"
            }
          ]
        }
      },
      "additionalProperties": false,
      "minProperties": 1
    },
    "testcase": {
      "title": "Test Case",
      "description": "A test case, i.e., a single instance to the problem.",
      "oneOf": [
        {
          "$ref": "#/$defs/command"
        },
        {
          "title": "Test case dictionary",
          "description": "Test case creation dictionary.",
          "type": "object",
          "properties": {
            "generate": {
              "$ref": "#/$defs/command"
            },
            "copy": {
              "type": "string",
              "title": "Copy",
              "description": "Copy this testcase from the given path relative to `/generators/`.",
              "examples": ["manual_cases/sample/3"]
            },
            "in": {
              "type": "string",
              "title": "Input",
              "description": "Explicit input given as a string"
            },
            "ans": {
              "type": "string",
              "title": "Default Answer",
              "description": "Explicit default answer given as a string"
            },
            "desc": {
              "type": "string",
              "title": "Description",
              "description": "Privileged information explaining the purpose of this test case given as a string"
            },
            "hint": {
              "type": "string",
              "title": "Hint",
              "description": "Feedback shown to the solver about this test case given as a string"
            },
            "interaction": {
              "title": "Sample interaction",
              "description": "Input is prefixed with `<`, output is prefixed with `>`.",
              "examples": ["<1 2\n>3\n<4 5\n>9\n<6 7\n>13\n"],
              "type": "string",
              "pattern": "^([<>][^\\n]*\\n)+$"
            },
            "visualizer": {
              "oneOf": [
                {
                  "$ref": "#/$defs/visualizer"
                },
                {
                  "type": "null"
                }
              ]
            },
            "random_salt": {
              "$ref": "#/$defs/random_salt"
            },
            "solution": {
              "$ref": "#/$defs/solution"
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "visualizer": {
      "title": "Visualizer",
      "description": "Absolute path to and arguments for a visualizer",
      "examples": [
        "/visualizer",
        "/visualizers/asy.py",
        "/visualizers/vis --large"
      ],
      "type": "string",
      "pattern": "^/[^{}]*(\\{seed(:[0-9]+)?\\}[^{}]*)*$"
    },
    "random_salt": {
      "title": "Random Salt",
      "type": "string",
      "description": "“Salt” to add to {seed} variables",
      "examples": ["abcd"]
    },
    "solution": {
      "title": "Default Solution",
      "description": "Absolute path to a solution for this problem or testcase.",
      "examples": ["/submissions/accepted/sol.py"],
      "$ref": "#/$defs/slashedfilepath"
    },
    "command": {
      "title": "Generator Invocation",
      "description": "Invocation of a generator to create this testcase",
      "examples": ["forest --n 40 --connected", "path.cpp 20", "random {seed}"],
      "type": "string",
      "pattern": "^[^{}]*(\\{seed(:[0-9]+)?\\}[^{}]*)*$"
    },
    "slashedfilepath": {
      "type": "string",
      "pattern": "^/([A-Za-z0-9][A-Za-z0-9_-]*[A-Za-z0-9]/)*[A-Za-z0-9][A-Za-z0-9_.-]*[A-Za-z0-9]$"
    },
    "unslashedfilepath": {
      "type": "string",
      "pattern": "^([A-Za-z0-9][A-Za-z0-9_-]*[A-Za-z0-9]/)*[A-Za-z0-9][A-Za-z0-9_.-]*[A-Za-z0-9]$"
    },
    "casepath": {
      "type": "string",
      "pattern": "^([A-Za-z0-9][A-Za-z0-9_-]*[A-Za-z0-9]/)*([A-Za-z0-9]|A-Za-z0-9][A-Za-z0-9_-]*[A-Za-z0-9]$"
    }
  },
  "$id": "https://json.schemastore.org/problem_package_generators.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": true,
  "description": "Generate test data for this problem. Version 0.9.",
  "properties": {
    "solution": {
      "$ref": "#/$defs/solution"
    },
    "visualizer": {
      "$ref": "#/$defs/visualizer"
    },
    "random_salt": {
      "$ref": "#/$defs/random_salt"
    },
    "generators": {
      "title": "Generators",
      "description": "List of generators for this problem.",
      "type": "object",
      "patternProperties": {
        "^([A-Za-z0-9][A-Za-z0-9_-]*[A-Za-z0-9]|[A-Za-z0-9])$": {
          "title": "Generator",
          "type": "array",
          "items": {
            "$ref": "#/$defs/unslashedfilepath"
          }
        }
      },
      "additionalProperties": false
    },
    "data": {
      "title": "testdata root",
      "description": "the root test group. must contain the testgroups 'sample' and 'secret'.",
      "type": "object",
      "properties": {
        "sample": {
          "$ref": "#/$defs/testgroup"
        },
        "secret": {
          "$ref": "#/$defs/testgroup"
        },
        "invalid_inputs": {
          "$ref": "#/$defs/testgroup"
        },
        "testdata.yaml": {
          "$ref": "#/$defs/testdata_settings"
        }
      },
      "additionalProperties": false,
      "required": ["sample", "secret"]
    }
  },
  "required": ["data"],
  "title": "Generator",
  "type": "object"
}
