Skip to content

Latest commit

 

History

History
48 lines (43 loc) · 1.24 KB

SCHEMA.md

File metadata and controls

48 lines (43 loc) · 1.24 KB

自定义 Schema 说明

MetaSchema (方言)

MetaSchema 用于自定义约束,即引即用。

使用 http://datacenter.dustlight.cn/v1/schemas/form 校验 Form 格式是否正确。 而 Form 本身用于校验 Record 格式是否正确。

示例

客户信息 Schema

{
  "$id": "http://datacenter.dustlight.cn/v1/schemas/",
  "type": "object",
  "title": "客户",
  "description": "客户信息",
  "properties": {
    "name": {
      "type": "string"
    },
    "birth": {
      "type": "string",
      "format": "date"
    },
    "company": {
      "$ref": "record",
      "form": "company"
    }
  },
  "additionalProperties": false,
  "required": ["name","company"]
}

客户信息

{
  "name": "Hansin",
  "company": "61ed3107e90b7406deb51211",
  "birth": "2022-01-01"
}