-
Notifications
You must be signed in to change notification settings - Fork 272
Description
1. Describe the bug
When calling a set of nested APIs in which a specific API appears in multiple levels, one of the instances of the API returns an empty list, when it shouldn´t. When the order of the $expands in the query is changed, the empty instance changes.
This happens in version 27.0.41766.0 (platform), however the same test was done in version 23.0.12831.0 and was not able to reproduce.
2. To Reproduce
Consider the following API structure:
- Root API (TableA)
- Nested API 1 (TableB)
- Nested API 2 (TableC)
- Nested API 3 (TableD)
- Nested API 2 (TableC)
- Nested API 4 (TableE)
- Nested API 3 (TableD)
- Nested API 1 (TableB)
3. Expected behavior
The expected correct output for the query would be the following:
{
"tableAField1": 1,
"tableB": [
{
"tableBField1": 1,
"tableC": [
{
"tableCField1": 1,
"tableD": [
{
"tableDField1": 1
}
]
},
{
"tableCField1": 2,
"tableD": [
{
"tableDField1": 2
}
]
}
]
}
],
"tableE": [
{
"tableEField1": 1
}
],
"tableD": [
{
"tableDField1": 2
}
]
}4. Actual behavior
What ends up heppening is, depending on the order of the $expands in the query, one of the instances of tableD returns empty when it shouldn´t (notice that the second and third instance of the API in the JSON return exactly the same, and it´s one of this instances that returns empty depending on the $expand order).
Example of the output when the query contains tableD first in the expands list and tableB($expand=tableC($expand=tableD)) second in te expand list:
{
"tableAField1": 1,
"tableB": [
{
"tableBField1": 1,
"tableC": [
{
"tableCField1": 1,
"tableD": [
{
"tableDField1": 1
}
]
},
{
"tableCField1": 2,
"tableD": [] // this instance is empty
}
]
}
],
"tableE": [
{
"tableEField1": 1
}
],
"tableD": [
{
"tableDField1": 2
}
]
}Example of the output when the query contains tableD second in the expands list and tableB($expand=tableC($expand=tableD)) first in te expand list:
{
"tableAField1": 1,
"tableB": [
{
"tableBField1": 1,
"tableC": [
{
"tableCField1": 1,
"tableD": [
{
"tableDField1": 1
}
]
},
{
"tableCField1": 2,
"tableD": [
{
"tableDField1": 2
}
]
}
]
}
],
"tableE": [
{
"tableEField1": 1
}
],
"tableD": [] // this instance becomes the empty one
}5. Versions:
- AL Language: 16.2.1869542
- Visual Studio Code: 1.106.0
- Business Central: 27.0.41766.0 (platform)
- List of Visual Studio Code extensions that you have installed: AL Language extension for Microsoft Dynamics 365 Business Central
- Operating System:
- Windows
- Linux
- MacOS