json schema

json schema 是一种json格式 规范,显示类结构信息,以后提供api时可以提供schema格式,但字段不能用‘_’分割,只能遵循驼峰命名,微软工程师要求的,具体不确定例如:spark_spec  -----  sparkSpec 

{
  "types": {
    "type": "string",
    "enum": [ "NONE", "COMPOUND", "DOCKER", "SPARK", "TF", "TFDIST", "SERVICE", 
"DOCKER_WIN", "SERVICE_WIN", "POOL", "INSTANCE", "POOL_WIN", "INSTANCE_WIN",
"DEPLOYMENT", "DEPLOYMENT_WIN" ]
  },
  "sparkSpec": {
    "type": "object",
    "properties": {
      "command": { "type": "string" },
      "resource": {
        "type": "object",
        "properties": {
          "numExecutors": { "type": "integer" },
          "executorCores": { "type": "integer" },
          "executorMemory": { "type": "integer" },
          "driverCores": { "type": "integer" },
          "driverMemory": { "type": "integer" }
        }
      }
    }
  },
  "tfSpec": {
    "type": "object",
    "properties": {
      "resource": {
        "type": "object",
        "properties": {
          "cpu": { "type": "number" },
          "gpu": { "type": "integer" },
          "memory": { "type": "integer" }
        }
      },
      "command": { "type": "string" },
      "image": { "type": "string" },
      "tensorboard": { "type": "boolean" },
      "tensorboardPort": { "type": "integer" },
      "hostEnvs": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "labels": {
            "type": "object",
            "properties": {
              "key": { "type": "string" },
              "value": { "type": "string" }
            }
          },
          "hosts": {
            "type": "object",
            "properties": {
              "ip": { "type": "string" },
              "hostNames": { "type": "string" }
            }
          },
          "volumeMounts": {
            "type": "object",
            "properties": {
              "name": { "type": "string" },
              "path": { "type": "string" },
              "mountPath": { "type": "string" }
            }
          },
          "env": {
            "type": "object",
            "properties": {
              "key": { "type": "string" },
              "value": { "type": "string" }
            }
          }
        }
      }
    }
  }
}

详情链接:https://json-schema.org/understanding-json-schema/index.html

schema 验证链接:https://jsonschemalint.com/#/version/draft-07/markup/json

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值