When calling the REST API testmanagement_campaigns/:id/testmanagement_executions
, sometimes the definition.all_requirements
is not an array but an object.
This is due to the fact that array_filter
(which is used to remove requirements artifacts that user cannot read) do not change array keys:
Array keys are preserved, and may result in gaps if the array was indexed. The result array can be reindexed using the array_values() function.
https://www.php.net/array_filter
When it is the case, then the json returned is not an array but an object with the numeric index of the associative array being the object index:
...
"all_requirements": {
"12": {
"id": 11226,
"uri": "artifacts/11226",
...
While the expected json would be:
...
"all_requirements": [
{
"id": 11226,
"uri": "artifacts/11226",
...