***.***.custom.input_schema: input_schema does not support oneOf, allOf, or anyO...

2026年10月28日 23:16 15.78 秒 success

错误信息

***.***.custom.input_schema: input_schema does not support oneOf, allOf, or anyOf at the top level (request id: 202610281515462127651898268d9d6MOmpL2Op)

AI 解决方案

🌐 错误翻译


原文:***.***.custom.input_schema: input_schema does not support oneOf, allOf, or anyOf at the top level (request id: 202610281515462127651898268d9d6MOmpL2Op)
译文:***.***.custom.input_schema:input_schema 不支持在顶层使用 oneOf、allOf 或 anyOf(请求 ID:202610281515462127651898268d9d6MOmpL2Op)

🎯 原因分析


这是 API 参数校验错误,错误根源是 input_schema 的定义在顶层使用了 JSON Schema 的组合关键字 oneOf、allOf 或 anyOf,而平台对 input_schema 的顶层结构有限制,仅允许单一对象或基础结构,不允许直接使用组合模式。

💡 解决方案


将顶层的组合模式拆解,改用 properties 配合 $ref 引用内部定义,或直接平铺字段。示例:
{
  "input_schema": {
    "type": "object",
    "properties": {
      "fieldA": {"type": "string"},
      "fieldB": {"type": "number"}
    },
    "required": ["fieldA", "fieldB"]
  }
}

若原本意图是多分支选择,建议在外层用普通字段区分,而非在 schema 顶层写 oneOf。

🛡️ 预防措施


  • ✅ 定义 input_schema 时,先确认平台支持的顶层结构,优先使用 type: object + properties 的标准写法。

  • ✅ 开发阶段用 JSON Schema 校验工具(如 ajv、Swagger Editor)提前验证 schema 合法性,避免提交不合规结构。