我正在 Microsoft Flow/Logic Apps 中创建一个自定义连接器,它基于带有 Microsoft 扩展(x-ms-dynamic-schema 和 x-ms-dynamic-values)的 Swagger 文件。
我现在想获取一个对象数组。这些对象中的每一个都具有相同的 JSON 模式。使用 x-ms-dynamic-schema 扩展,可以声明逻辑应用程序/流设计器需要获取响应的 JSON 模式,以便您可以提供对象的属性。
我想要实现的是:
- 我在我的连接器(“ListEntities”)上有一个操作,它获取我感兴趣的某个实体(= 对象类型)的对象数组。
- 相同的操作会选取该实体类型的架构并显示响应的属性。
到目前为止我尝试了什么:
获取架构的操作:
"/api/entitydefinitions/{type}": { "get": { "summary": "Get Entity Definition Schema", "description": "Gets the schema of an entity definition.", "operationId": "GetEntitySchemaByDefinition", "produces": [ "application/json" ], "parameters": [ { "name": "type", "type": "string", "in": "path", "description": "Select Entity you want to query", "required": true, "x-ms-summary": "Select Entity" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object" } } } } }
获取实体列表的操作:
"/api/entitydefinitions/{type-dynamic}/entities": {
"get": {
"summary": "List entities",
"description": "Gets entities",
"operationId": "ListEntitiesByDefinition",
"parameters": [
{
"name": "type-dynamic",
"type": "string",
"in": "path",
"description": "Select entity definition",
"required": true,
"x-ms-summary": "Entity Definition",
"x-ms-dynamic-values": {
"operationId": "ListEntityDefinitions",
"value-path": "name",
"value-title": "name",
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ListEntitiesByDefinitionResponse"
}
}
}
}
}
上述响应的定义
"ListEntitiesByDefinitionResponse": { "type": "object", "x-ms-dynamic-schema": { "operationId": "GetEntitySchemaByDefinition", "parameters": { "type": { "parameter": "type-dynamic" } }, "value-path": "items" } },
现在,我的输出示例:
[
{
"id": 4541,
"identifier": "123456789",
"Name": "Name 1",
"Description": "",
},
{
"id": 4542,
"identifier": "987654321",
"Name": "FromPostman",
"Description": "",
}
]
我的架构:
{
"type": "array",
"items": {
"title": "Example",
"type": "object",
"properties": {
"id": {
"type": "integer",
"x-ms-summary": "id"
},
"identifier": {
"type": "string",
"x-ms-summary": "identifier"
},
"Name": {
"type": "string",
"x-ms-summary": "Name"
},
"Description": {
"type": "string",
"x-ms-summary": "Description"
}
},
"required": []
}
}
问题是我的流程应用程序确实向我显示了设计模式下的属性:
但是,我希望插入一个循环(适用于每个循环)
流程本身也不起作用,只是因为它没有循环数组中的对象。
已经在这方面花费了太多时间并寻求您的帮助。