【问题标题】:Azure custom connector dynamic schema not workingAzure 自定义连接器动态架构不起作用
【发布时间】:2022-01-10 22:27:01
【问题描述】:

尝试使用x-ms-dynamic-values(按预期工作)和x-ms-dynamic-schema(似乎不起作用) 我只得到身体参数名称dynamicActionSchema 而不是动态模式。

这些是我的路径:

paths:
  /api/v1/actions:
    get:
      description: Get lists
      summary: Get's action list you have access to
      operationId: GetActionsList
      parameters:
      - {in: query, name: include_attributes, default: ref, type: string, description: The
          number of items to skip before starting to collect the result set}
      responses:
        '200':
          description: OK
          schema: {$ref: '#/definitions/GetLists'}
  /api/v1/actions/{actionId}:
    get:
      description: Gets the schema of the selected action
      summary: Get's the schema of the selected action
      operationId: GetActionSchema
      parameters:
      - {name: actionId, in: path, required: true, type: string, x-ms-summary: Select
          Action}
      responses:
        '200':
          description: OK
          schema: {type: object}
  /api/v1/executions/{action}:
    post:
      description: Executing ST action - Uses Dynamic values and dynamic schema to
        draw form
      summary: Executing ST action
      operationId: ExecuteSTAction
      parameters:
      - name: action
        type: string
        in: path
        description: Select action you want to execute
        required: true
        x-ms-summary: Select Action
        x-ms-dynamic-values: {operationId: GetActionsList, value-path: ref}
      - name: dynamicActionSchema
        in: body
        description: Dynamic Schema of items in selected action
        schema:
          type: object
          x-ms-dynamic-schema:
            operationId: GetActionSchema
            parameters:
              actionId: {parameter: action}
            value-path: parameters
      responses:
        '201': {description: Executed}
definitions:
  GetLists:
    type: array
    items:
      type: object
      properties:
        ref: {type: string}
      required: [ref]
security:
- API Key: []

动态模式操作输出示例:

{
  "parameters": {
    "tags": {
      "description": "List of tags for item.",
      "required": false,
      "type": "array",
      "position": 12
    },
    "env": {
      "description": "Environment variables which will be available to the script.",
      "type": "object"
    },
    "detected": {
      "description": "The datetime for detecting the item.",
      "required": true,
      "type": "string",
      "position": 6
    },
    "description": {
      "description": "The description of the item.",
      "required": false,
      "type": "string",
      "position": 2
    }
    ...
  }
}

完整示例: https://github.com/microsoft/PowerPlatformConnectors/blob/070009ba5681fd57ee6cc61d2a380123712a088f/certified-connectors/Ticketing.events/apiDefinition.swagger.json

MS 文档: https://docs.microsoft.com/en-us/connectors/custom-connectors/openapi-extensions#use-dynamic-schema

在 Power Apps 论坛中打开线程: https://powerusers.microsoft.com/t5/Building-Power-Apps/Dynamic-schema-doesn-t-seems-to-work-based-on-a-body-parameter/m-p/1373866#M357492

【问题讨论】:

标签: azure azure-logic-apps powerapps power-automate-custom-connector


【解决方案1】:

发现我的问题,架构应该是:

{
    "parameters": {
        "type": "object",
        "properties": {
            "debug": {
                "default": false,
                "required": false,
                "description": "Enable runner debug mode.",
                "type": "boolean"
            },
            ...
        }
    }
}

【讨论】:

    猜你喜欢
    • 2022-10-25
    • 1970-01-01
    • 1970-01-01
    • 2015-02-01
    • 1970-01-01
    • 2017-03-05
    • 1970-01-01
    • 2016-02-16
    • 1970-01-01
    相关资源
    最近更新 更多