TIBCOSoftware / mashling

Project Mashling
86 stars 15 forks source link

Add more flexible response handling #188

Closed jeffreybozek closed 6 years ago

jeffreybozek commented 6 years ago

This PR allows for more flexible response handling and maps output more explicitly to Flogo's reply handling.

Now response output has separate 'code' and 'data' elements. The data element can contain nested structures or have a simple top level response directly without the requirement to add another key.

This response:

              {
                "if": "PetStorePets.response.body.status == 'available'",
                "error": false,
                "output": {
                  "code": 200,
                  "format": "json",
                  "body.pet": "${PetStorePets.response.body}",
                  "body.inventory": "${PetStoreInventory.response.body}"
                }
              }

becomes:

              {
                "if": "PetStorePets.response.body.status == 'available'",
                "error": false,
                "output": {
                  "code": 200,
                  "data": {
                    "pet": "${PetStorePets.response.body}",
                    "inventory": "${PetStoreInventory.response.body}"
                  }
                }
              }