Question

Does Tosca support JSONPath with conditions?

  • 20 November 2023
  • 0 replies
  • 38 views

Badge

For one of requests in an API test, I need to set a value for a property with name 'second-property-name' in JSON like this:

{
"properties": [
{
"id": "first-property-name",
"values": [
"firstPropertyValue"
]
},
{
"id": "second-property-name",
"values": [
"secondPropertyValue"
]
},
...
]
}

When I add a Module attribute for the property, Tosca generates "properties[*].values[*]" as JSONPath. I want to use the property name instead of a hardcoded index, so I added this "?(@.id == 'second-property-name')" instead of '*' (properties[?(@.id == 'second-property-name')].values[*]). Now, when I click on the module attribute, Tosca highlights the value for the second property, and it looks like everything is fine. However, when I start an execution, it doesn't work, and I see the following message: "Failed to create Token."


0 replies

Be the first to reply!

Reply