'How to make a Swagger definition for a JSON with identical fields

I have to integrate our API as a "Custom Connector" in Power Automate (we do not have a premium account so I have to work with what I have). The problem is the request requires a JSON with nested fields, which have identical names (but different uses).

The API is with a third party so I have no access to changing its specs.

My problem is adding this to PA, when it is converted into a Swagger 2.0 definition, the identical named fields get mixed together, and this runs into an error (The response is 200, but the object it modifies does not change properly and so I cannot move on to the next request).

All of these fields are required, and the values for the first five I need to make variable. The rest should be inputted exactly as seen for every request. It is supposed to run a report, from which I'll take the instance ID from the response JSON and move it on to the next request. Since the ran report had an error, it does not generate values for that instance and so my next request is stuck with a 404.

The current setup, all values in fields named "fieldName" get sent as "null" to the server.

I've scoured the internet and can't seem to find how to add these nested fields. I might be missing some of the lexicon to look for. With them having the same name I get a mapping error.

{
    "reportUuid": "(Alphanumeric String)",
    "endDate": "2022-2-1",
    "startDate": "2022-2-1",
    "endDateTime": "2022-02-01T23:59:59-0800",
    "startDateTime": "2022-02-01T00:00:00-0800",
    "dateRangeField": "EventStartTime",
    "queryExpression": {
        "collectionName": "TicketAnalytics",
        "findQueries": [
            {
                "fieldName": "EventName",
                "fieldValue": "Gift Cards",
                "operator": "not equal to"
            }
        ],
        "findFields": [
            {
                "fieldName": "EventName",
                "include": true
            },
            {
                "fieldName": "TicketQuantity",
                "include": true
            },
            {
                "fieldName": "CheckedInCount",
                "include": true
            }
        ],
        "sortFields": [
            {
                "fieldName": "EventName",
                "ascending": true
            }
        ],
        "groupFields": [
            {
                "fieldName": "EventName",
                "groupFunction": null
            }
        ],
        "summaryFields": [
            {
                "fieldName": "TicketQuantity",
                "summaryFunction": "Sum"
            },
            {
                "fieldName": "CheckedInCount",
                "summaryFunction": "Sum"
            }
        ],
        "limit": 0
    }
}    

As you can see, the "Find Fields" and the "Summary Fields" get collapsed, their sub-fields are just one each. I have to preserve ALL the field names (I haven't modified the required/default values in this example).

  summary: Post a new Report
  description: Creates a new reporting instance
  operationId: POSTReport
  parameters:    
  - {name: reportUuid, in: query, required: false, type: string}
  - {name: sortDirection, in: query, required: false, type: string}
  - {name: sortField, in: query, required: false, type: string}
  - {name: pageSize, in: query, required: false, type: integer}
  - {name: page, in: query, required: false, type: integer}
  - name: body
    in: body
    required: false
    schema:
      type: object
      properties:
        reportUuid: {type: string, description: reportUuid}
        endDate: {type: string, description: endDate}
        startDate: {type: string, description: startDate}
        endDateTime: {type: string, description: endDateTime}
        startDateTime: {type: string, description: startDateTime}
        dateRangeField: {type: string, description: dateRangeField}
        queryExpression:
          type: object
          properties:
            collectionName: {type: string, description: collectionName}
            findQueries:
              type: array
              items:
                type: object
                properties:
                  fieldName: {type: string, description: fieldName}
                  fieldValue: {type: string, description: fieldValue}
                  operator: {type: string, description: operator}
              description: findQueries
            findFields:
              type: array
              items:
                type: object
                properties:
                  fieldName: {type: string, description: fieldName}
                  include: {type: boolean, description: include}
              description: findFields
            sortFields:
              type: array
              items:
                type: object
                properties:
                  fieldName: {type: string, description: fieldName}
                  ascending: {type: boolean, description: ascending}
              description: sortFields
            groupFields:
              type: array
              items:
                type: object
                properties:
                  fieldName: {type: string, description: fieldName}
                  groupFunction: {type: string, description: groupFunction}
              description: groupFields
            summaryFields:
              type: array
              items:
                type: object
                properties:
                  fieldName: {type: string, description: fieldName}
                  summaryFunction: {type: string, description: summaryFunction}
              description: summaryFields
            limit: {type: integer, format: int32, description: limit}
          description: queryExpression


Solution 1:[1]

I found my own solution:

In creating the connectors, I left the body definition to simply:

{}

Which gave me an open field to use in the Power Automate flow. Turn off encoding, and I can just paste the JSON into that field, manipulating as I need.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Joey