Javascript JSON模式:是否有字段为字段指定元数据?
如果我有JSON模式,例如:Javascript JSON模式:是否有字段为字段指定元数据?,javascript,json,user-interface,jsonschema,Javascript,Json,User Interface,Jsonschema,如果我有JSON模式,例如: { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "http://example.com/product.schema.json", "title": "Product", "description": "A product i
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/product.schema.json",
"title": "Product",
"description": "A product in the catalog",
"type": "object"
}
JSON模式规范中是否定义了允许我添加选项的字段?我正在考虑使用JSON模式本身来生成UI表单,但我想添加一个隐藏字段的选项。所以我想做一些类似的事情:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/product.schema.json",
"title": "Product",
"description": "A product in the catalog",
"type": "object",
"options" : {
"isVisible": false
}
}
这是有效的JSON模式还是有标准字段可用于此目的?默认情况下,JSON模式计算器将忽略他们无法识别的关键字,因此您可以自由创建新关键字,例如
选项
但是,有一个关键字用于您在此处描述的目的:readOnly
和writeOnly
:设置“writeOnly”:true
应指示(对于支持此关键字的工具)属性永远不应可见