【问题标题】:Azure Logic App - Parse JSON Schema fails "Required properties are missing from object"Azure 逻辑应用 - 解析 JSON 架构失败“对象中缺少必需的属性”
【发布时间】:2022-01-06 22:03:57
【问题描述】:

我有一个包含 3 个属性的表,其中只有两个属性包含数据。我使用 SQL 连接器获取数据,然后将其传递到“解析 JSON”模块。

以下是我的 SQL 连接器的输出:

{
  "@odata.context": "https://logic-apis-southeastasia.azure-apim.net/apim/sql/somethings/items",
  "value": [
    {
      "@odata.etag": "",
      "ItemInternalId": "Some alpha-numeric id",
      "userEmail": "somename@blabla.com",
      "someCode": "someCode"
    },
    {
      ...
    },
    ...
  ]
}

对于上面的输出,我的 JSON Schema 对于“Values”标签如下:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "@@odata.etag": {
                "type": "string"
            },
            "ItemInternalId": {
                "type": "string"
            },
            "userEmail": {
                "type": "string"
            },
            "someCode": {
                "type": "string"
            }
        },
        "required": [
            "@@odata.etag",
            "ItemInternalId",
            "userEmail",
            "someCode"
        ]
    }
}

当我运行我的逻辑应用程序时,“解析 JSON”连接器中出现以下错误:

[
  {
    "message": "Required properties are missing from object: someCode.",
    "lineNumber": 0,
    "linePosition": 0,
    "path": "[318]",
    "value": [],
    "schemaId": "#/items",
    "errorType": "required",
    "childErrors": []
  }
]

最初,我的表中有 4-5 个数据指针,Parse JSON 连接器工作正常。我又插入了几条记录,现在我收到了这个错误。我不明白这可能是什么问题..

请帮忙。

【问题讨论】:

  • 您能否删除架构中的“必需”部分并重试,是否仍然出现错误?
  • 您不是使用 SQL 连接器的输出生成 JSON Schema 吗?
  • 感谢@RickyG 的输入,您的解决方案奏效了。
  • @SwethaKandikonda-MT 我只使用 SQL 连接器输出生成 JSON 模式,但它仍然给我错误。
  • @shreyansjain 我会把它作为答案,以便其他人在遇到相同问题并且您标记为已回答时学习

标签: sql json azure azure-logic-apps


【解决方案1】:

我相信这取决于您需要的标签。

{
"type": "array",
"items": {
    "type": "object",
    "properties": {
        "@@odata.etag": {
            "type": "string"
        },
        "ItemInternalId": {
            "type": "string"
        },
        "userEmail": {
            "type": "string"
        },
        "someCode": {
            "type": "string"
        }
    }
}

}

像上面那样去掉所需的标签,或者在你的输入中传递一些东西到你的 etag 中,而不仅仅是一个空字符串

"@odata.etag": "<dont leave this empty, pass something in>"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-11-11
    • 1970-01-01
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多