Some of our less-used internal APIs are returning nested arrays instead of normal ones. You can see an example below:
We're returning a one-element array, and that element is the array that we actually wanted to return! Seems like we probably weren't using the Json.arr() function correctly in Scala, and then an early mistake was copied repeatedly as we added more API endpoints! I know for sure that we're doing this for /userapi/labelCounts/all and /userapi/validationCounts/all, but I suspect that we're doing it for many others, since we seem to be using Json.arr() in the same way in a lot of places. Most of these are likely just private APIs that are used primarily on our admin page.
Potential solution(s)
I'd like to have someone go through and find all the instances of this, probably just by searching for places where we use Json.arr(), check if the output of each of those APIs have this same issue, and fix it for any such APIs. Make sure to look at where we use those APIs as well, and make the appropriate adjustments on the front-end!
Brief description of problem/feature
Some of our less-used internal APIs are returning nested arrays instead of normal ones. You can see an example below:
We're returning a one-element array, and that element is the array that we actually wanted to return! Seems like we probably weren't using the
Json.arr()
function correctly in Scala, and then an early mistake was copied repeatedly as we added more API endpoints! I know for sure that we're doing this for/userapi/labelCounts/all
and/userapi/validationCounts/all
, but I suspect that we're doing it for many others, since we seem to be usingJson.arr()
in the same way in a lot of places. Most of these are likely just private APIs that are used primarily on our admin page.Potential solution(s)
I'd like to have someone go through and find all the instances of this, probably just by searching for places where we use
Json.arr()
, check if the output of each of those APIs have this same issue, and fix it for any such APIs. Make sure to look at where we use those APIs as well, and make the appropriate adjustments on the front-end!