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