UIGF-org/UIGF-org.github.io

UIGF 的 JSON Schema 不起作用

Closed this issue · 1 comments

目前,https://uigf.org/schema/uigf.json 的内容是这样的:

{
  "root": {
    "type": "object",
    "properties": {
      "info": { ... },
      "list": { ... }
    },
    "required": ["info", "list"],
    "title": "UIGF 根对象"
  }
}

但我发现此 schema 并不能起到任何校验和提示的作用:使用 https://www.jsonschemavalidator.net 在线校验工具,无论输入什么数据都能校验通过;在 VS Code 中为 UIGF 数据添加 "$schema": "https://uigf.org/schema/uigf.json" 后,并不能正常触发代码提示。

经测试,需要以当前 "root" 属性的内容直接作为根对象,才能有效校验:

/path/to/uigf.json:

{
  "type": "object",
  "properties": {
    "info": { ... },
    "list": { ... }
  },
  "required": ["info", "list"],
  "title": "UIGF 根对象"
}

祈愿记录文件:

{
  "$schema": "file:///path/to/uigf.json",
  "info": { ... },
  "list": [ ... ]
}

这样,在 VS Code 中方可看到校验错误和代码提示:

希望 UIGF 网站可以修改 schema 文件以便直接引用。