!!!JDT Test discriminator in AJV v7.1.1

by Leo

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/ajv/8.10.0/ajvJTD.min.js"></script>
<p>
Test discriminator in AJV v8.10.0
See  <a href="https://cdnjs.com/libraries/ajv">cdnjs:ajv </a>
</p>

CSS

html, document {
  background-color: black;
}

JavaScript

var schema = {
  "definitions": {
    "Bar": {
      "properties": {
        "id": {
          "type": "string"
        }
      }
    }
  },
  "properties": {
    "sheets": {
      "elements": {
        "discriminator": "type",
        "mapping": {
          "PaperSheet": {
            "properties": {
              "charts": {
                "elements": {
                  "discriminator": "type",
                  "mapping": {
                    "bar": {
                      "properties": {
                        "id": {
                          "type": "string"
                        }
                      }
                    },
                    "line": {
                      "properties": {
                        "id": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
;



var json = {
    "templateId": "af51521c-4482-411f-988d-4711f1422451",
    "templateName": "SA_TEmplate_002",
    "sheets": [
        {
            "id": "2fdfc82e-34c7-4835-ba13-864e95df1b8b",
            "sheetName": "Coverage 4G",
            "technology": "4G",
            "charts": [],
            "acceptanceKpis": [],
            "type": "mdt",
            "kpiThresholds": [
                {
                    "kpiName": "rsrqDiscrepancyPct",
                     // todo: changed type
                    "threshold": 61.000000
                },
                {
                    "kpiName": "overshootingPct",
                     // todo: changed type
                    "threshold": 62.000000
                },
                {
                    "kpiName": "interferencePct",
                     // todo: changed type
                    "threshold": 63.000000
                },
                {
                    "kpiName": "lowThroughputPct",
                     // todo: changed type
 ...