{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.modernedi.com/integration-api/mapping-regression-case.schema.json",
  "title": "Saved mapping test case",
  "description": "An exact-output test for the existing Mapper engines. Whitespace, line endings, ordering, and delimiters are significant. Incoming X12 Mapper requires application/edi-x12 and null params; its zero-based group and transaction selectors may be null. Outgoing JSLT/XSLT requires JSON/XML input and null selectors; params is an object or null. Outgoing cases may additionally select validateX12 to check the generated document against the mapping's X12 specification using the normal preview/send envelope preparation. No execution results or timestamps belong in this source document.\n",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "name",
    "comparison",
    "input",
    "contentType",
    "params",
    "functionalGroupIndex",
    "transactionIndex",
    "expectedOutput"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,63}$",
      "maxLength": 64
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120,
      "pattern": "\\S"
    },
    "comparison": {
      "type": "string",
      "enum": [
        "EXACT_TEXT"
      ]
    },
    "validateX12": {
      "type": "boolean",
      "description": "Optional outgoing-only document validation in addition to exact-text comparison. Defaults to false when omitted. Complete document bodies are wrapped for validation; partial fragments need not opt in. Does not send EDI or prove business correctness or partner acceptance."
    },
    "input": {
      "type": "string",
      "maxLength": 65536
    },
    "contentType": {
      "type": "string",
      "enum": [
        "application/edi-x12",
        "application/json",
        "application/xml",
        "text/xml"
      ]
    },
    "params": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true
    },
    "functionalGroupIndex": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "maximum": 2147483647
    },
    "transactionIndex": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "maximum": 2147483647
    },
    "expectedOutput": {
      "type": "string",
      "maxLength": 65536
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "contentType": {
            "const": "application/edi-x12"
          }
        }
      },
      "then": {
        "properties": {
          "params": {
            "type": "null"
          },
          "validateX12": {
            "const": false
          }
        }
      },
      "else": {
        "properties": {
          "functionalGroupIndex": {
            "type": "null"
          },
          "transactionIndex": {
            "type": "null"
          }
        }
      }
    }
  ]
}
