Trying to get Swagger definition properties in RPC

Hi,
I am trying to parse a swagger.json 2.0 response in my RPC to retrieve all properties of a specific entity. Unfortunately, the result is empty. What

  "response": {
    "output": {
      "label": "{{item}}",
      "value": "{{item}}"
    },
    "iterate": "{{  keys(   get(get(get(body.definitions, 'Account'),'allOf')[2],'properties')   )  }}"
  }

This is an excerpt from the swagger definition:

{
  "definitions" : {
   "Account": {
      "allOf": [
        {
          "$ref": "#/definitions/Entity"
        },
        {
          "type": "object",
          "properties": {
            "AccountGroupID": {
              "$ref": "#/definitions/StringValue"
            },
            "Active": {
              "$ref": "#/definitions/BooleanValue"
            },
            "Attributes": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/AttributeValue"
              }
            },
            "DefaultAccountID": {
              "$ref": "#/definitions/StringValue"
            },
            "Description": {
              "$ref": "#/definitions/StringValue"
            },
            "Expense": {
              "$ref": "#/definitions/BooleanValue"
            },
            "SortOrder": {
              "$ref": "#/definitions/ShortValue"
            },
            "Type": {
              "$ref": "#/definitions/StringValue"
            }
          }
        }
      ]
    }
  }
}

Who can help?

Jörg

Hi @Jorg_Ackermann, I am not sure but could you try to put “‘allOf’)[1],” instead of “‘allOf’)[2],”?
Usually indexing in javascript arrays starts at 0 and I thinks it’s js in the RPC code?

@Richard_Johannes Unfortunately, this does not help. The documentation says:

Unlike JavaScript, IML uses 1 to access the first item in an array.

Hi @Jorg_Ackermann, sorry! Lazy me!

Another possible solution though:

As far as I can see you are pointing to an object (properties) but iterate is for arrays. You might just want to use output directly ? :slight_smile:

1 Like