{
  "$defs": {
    "test-ref1": {
      "pattern": "^\\{\\{.+\\}\\}$",
      "type": "string"
    },
    "test-ref2": {
      "type": "integer"
    }
  },
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "additionalProperties": false,
  "properties": {
    "parameters": {
      "additionalItems": {
        "oneOf": [
          {
            "properties": {
              "name": {
                "const": "param-optional"
              },
              "value": {
                "anyOf": [
                  {
                    "$ref": "#/$defs/test-ref1"
                  },
                  {
                    "$ref": "#/$defs/test-ref2"
                  }
                ]
              }
            },
            "required": [
              "name",
              "value"
            ],
            "type": "object"
          }
        ]
      },
      "items": [
        {
          "properties": {
            "name": {
              "const": "param-required"
            },
            "value": {
              "anyOf": [
                {
                  "$ref": "#/$defs/test-ref1"
                },
                {
                  "$ref": "#/$defs/test-ref2"
                }
              ]
            }
          },
          "required": [
            "name",
            "value"
          ],
          "type": "object"
        }
      ],
      "maxItems": 2,
      "minItems": 1,
      "type": "array",
      "uniqueItems": true
    }
  },
  "type": "object"
}