最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Power automate Flow doesn't create dynamic form. The response from API with status code '200' does not c

programmeradmin1浏览0评论

I am new to Power Automate and I am creating a custom connector with a couple of actions that should interact with Jira. The general idea is that I will be able to create a couple of flows to facilitate my work. Yes, I know there's already a Jira connector but, unfortunately, it doesn't suit my needs.

Everything was fine until I decided to use dynamic schemas to generate the form to create an issue. So when the user picks a Project and the Issue Type, the form should be generated according to the response from ListIssueTypesFields. Here's a snippet from CreateIssue (cut responses as it's not needed):

/issue:
  post:
    summary: Create a new issue
    tags:
      - Issues
    description: This operation is used to create a new issue.
    operationId: CreateIssue
    parameters:
      - name: projectIdOrKey
        in: query
        required: true
        type: string
        x-ms-summary: Project
        description: Pick a project to create the issue in.
        x-ms-url-encoding: single
        x-ms-dynamic-values:
          operationId: ListProjects
          value-path: key
          value-title: name
      - name: issueTypeIds
        in: query
        required: true
        x-ms-summary: Issue Type Id
        description: Pick an issue type.
        x-ms-dynamic-values:
          operationId: ListIssueTypes
          parameters:
            projectIdOrKey:
              parameter: projectIdOrKey
          value-collection: values
          value-path: id
          value-title: name
        type: string
      - name: item
        in: body
        description: Item
        schema:
          type: object
          x-ms-dynamic-properties:
            itemValuePath: values
            operationId: ListIssueTypesFields
            parameters:
              projectIdOrKey:
                parameterReference: projectIdOrKey
              issueTypeId:
                parameterReference: issueTypeIds
          x-ms-dynamic-schema:
            operationId: ListIssueTypesFields
            parameters:
              projectIdOrKey:
                parameter: projectIdOrKey
              issueTypeId:
                parameter: issueTypeIds
            value-path: values
    responses:
      (...)

And here's the ListIssueTypesFields:

/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}:
get:
  summary: Get issue types fields
  description: >-
    This operation is used to retrieve a list of fields for a specific issue
    type.
  operationId: ListIssueTypesFields
  parameters:
    - name: projectIdOrKey
      in: path
      required: true
      x-ms-summary: Project
      type: string
    - name: issueTypeId
      in: path
      required: true
      x-ms-summary: Issue Types
      type: string
  responses:
    '200':
      description: OK
      schema:
        type: object
        properties:
          values:
            type: array
            items:
              type: object
              properties:
                required:
                  type: boolean
                name:
                  type: string
                fieldId:
                  type: string
                schema:
                  type: object
                allowedValues:
                  type: array
                  items:
                    type: object
                hasDefaultValue:
                  type: boolean
                operations:
                  type: array
                  items:
                    type: string
  deprecated: false
  x-ms-visibility: advanced

Here is a snippet of the JSON result which contains the fields when the user picks an Epic:

{
  "maxResults": 50,
  "startAt": 0,
  "total": 17,
  "isLast": true,
  "values": [
    {
      "required": true,
      "schema": {
        "type": "issuetype",
        "system": "issuetype"
      },
      "name": "Issue Type",
      "fieldId": "issuetype",
      "hasDefaultValue": false,
      "operations": [],
      "allowedValues": [
        {
          "self": ";,
          "id": "10000",
          "description": "Created by Jira Software - do not edit or delete. Issue type for a big user story that needs to be broken down.",
          "iconUrl": ";avatarId=11607&avatarType=issuetype",
          "name": "Epic",
          "subtask": false,
          "avatarId": 11607
        }
      ]
    },
    {
      "required": true,
      "schema": {
        "type": "string",
        "custom": "com.pyxis.greenhopper.jira:gh-epic-label",
        "customId": 10004
      },
      "name": "Epic Name",
      "fieldId": "customfield_10004",
      "hasDefaultValue": false,
      "operations": [
        "set"
      ]
    },
    {
      "required": true,
      "schema": {
        "type": "string",
        "system": "summary"
      },
      "name": "Summary",
      "fieldId": "summary",
      "hasDefaultValue": false,
      "operations": [
        "set"
      ]
    },
    {
      "required": true,
      "schema": {
        "type": "user",
        "system": "reporter"
      },
      "name": "Reporter",
      "fieldId": "reporter",
      "autoCompleteUrl": "=",
      "hasDefaultValue": false,
      "operations": [
        "set"
      ]
    },
    {
      "required": false,
      "schema": {
        "type": "user",
        "custom": "com.atlassian.jira.plugin.system.customfieldtypes:userpicker",
        "customId": 21702
      },
      "name": "Reviewer",
      "fieldId": "customfield_21702",
      "autoCompleteUrl": ".0/users/picker?fieldName=customfield_21702&query=",
      "hasDefaultValue": false,
      "operations": [
        "set"
      ]
    },
    {
      "required": false,
      "schema": {
        "type": "string",
        "system": "description"
      },
      "name": "Description",
      "fieldId": "description",
      "hasDefaultValue": false,
      "operations": [
        "set"
      ]
    },
    (...)
  ]
}

When I call ListIssueTypesFields I get the data without issues. But when I call CreateIssue and try to pick the Issue Type to generate the form, I get the following exception: Failed to retrieve dynamic inputs. Error details: 'The response from API 'xyz' operation 'ListIssueTypesFields' with status code '200' does not contain a valid OpenAPI schema object.'.

As I can't find a way to properly debug this, the question is: What should I change to have a valid OpenAPI schema so I can have my dynamic form?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论