美文网首页
JSONSchema array

JSONSchema array

作者: 寻找无名的特质 | 来源:发表于2023-03-18 07:00 被阅读0次

如果定义类型是array,需要定义items的属性,如果items的类型是object,那么在相关属性中需要定义object具有的属性。下面是array的示例:

 "paramtable": {
      "type": "array",
      "description": "流程变量表",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "变量名称"
          },
          "type": {
            "enum": [ "string", "int", "bool", "float" ],
            "description": "变量类型"
          },
          "desc": {
            "type": "string",
            "description": "变量描述"
          },
          "extern_store": {
            "type": "string",
            "description": "外部存储"
          }
        },
        "additionalProperties": false
      }
    }

在上面的示例中,数组中可以包括的对象具有的属性是name,type,desc和exten_store,并且不允许其它属性。如果属性中包括object类型,就需要层级定义。

相关文章

网友评论

      本文标题:JSONSchema array

      本文链接:https://www.haomeiwen.com/subject/qdxdrdtx.html