Refering to value of maximum characters allowed, 在控制台中抛出错误

问题描述 投票:0回答:0

在下面给出的例子中:

{
  "default": "adsds",
  "max": 1
}

我想引用动态提供的“最大”值,并想验证在“默认”字段中输入的字符数。因此,我开发了如下架构:

{
  "type": "object",
  "properties": {
    "max": {
      "type": "integer"
    },
    "default": {
      "type": "string",
      "maxLength": {
        "$data": "1/max"
      }
    }
  }
}

但这似乎不起作用,并且在控制台中抛出错误,因为, ERROR 错误:模式无效:data/properties/default/maxLength 必须是整数

请点击以下链接查看上述问题 https://codesandbox.io/s/beautiful-frog-2hrlch?file=/src/app/app.component.ts

版本: "ajv": "^8.12.0", “ajv-错误”:“^3.0.0”, “ajv-关键字”:“^5.1.0”,

我什么都试了,还是不行

angular typescript jsonschema json-schema-validator ajv
© www.soinside.com 2019 - 2024. All rights reserved.