Azure 逻辑应用程序 - 解析 JSON 架构失败 "Required properties are missing from object"

Azure Logic App - Parse JSON Schema fails "Required properties are missing from object"

我有一个 table,它有 3 个属性,其中只有两个属性包含数据。我使用 SQL 连接器获取数据,然后将其传递到“Parse 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 架构对于“值”标签如下:

{
    "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": []
  }
]

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

请帮忙。

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

{
"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>"