gpt4 book ai didi

$ref 的 JSONSchema 验证失败(草案 v3)

转载 作者:行者123 更新时间:2023-12-04 11:00:38 28 4
gpt4 key购买 nike

我已经按照 v3 规范草案创建了一个 JSON 模式。架构如下所示:

{
"$schema": "http://json-schema.org/draft-03/schema#",
"additionalProperties": false,
"type": "object",
"properties": {
"ExecutionPlanList": {
"type": "array",
"items": [{
"type": "object",
"properties": {
"model": {
"required": true,
"properties": {
"featureList": {
"required": true,
"items": {
"properties": {
"featureName": {
"type": ["string", "null"]
},
"featureType": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"modelId": {
"required": true,
"type": "string"
}
},
"type": "object"
},
"cascadeSteps": {
"required": false,
"items": {
"properties": {
"binaryModel": {
"$ref": "#/properties/ExecutionPlanList/items/properties/model",
"required": true
},
"threshold": {
"required": true,
"default": "0.0",
"maximum": 100.0,
"type": "number"
},
"backupModel": {
"$ref": "#/properties/ExecutionPlanList/items/properties/model",
"required": true
}
}
},
"type": "array"
},
"marketplaceId": {
"required": true,
"type": "integer"
}
}
}]
}
},
"required": true
}

本质上, executionPlanList 包含模型和级联步骤的列表,每个级联步骤包含两个带有编号的模型。所以我试图在级联步骤中重新使用模型的模式,但验证( https://www.jsonschemavalidator.net/ )失败了 Could not resolve schema reference '#/properties/ExecutionPlanList/items/properties/model' .

非常感谢有关此架构有什么问题的任何指示。

最佳答案

它应该是“#/properties/ExecutionPlanList/items/0/properties/model”

顺便说一下,模式只验证第一项。

关于$ref 的 JSONSchema 验证失败(草案 v3),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47219108/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com