•  
      request #44471 all_requirements should always be an array
    Infos
    #44471
    Nicolas Terray (nterray)
    2025-09-08 11:45
    2025-09-01 16:18
    46183
    Details
    all_requirements should always be an array

    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",
              ...
    
    Test Management
    16.10
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Nicolas Terray (nterray)
    Closed
    2025-09-02
    Attachments
    Empty
    References
    Referencing request #44471

    Follow-ups