Client's API returns a very weird response that changes its structure depending on its content.

When a array field has more than 1 children it returns:

"field" : [
{ "name1" : "value1"},
{ "name2" : "value2"}

So far so good. However, the fuckery happens when it has 1 children:

"field" : { "name1" : "value1"}

WTF! So the client API can return either a JSON object or an array and we cant trust the specs they gave us.

  • 18
    @notcool It makes it awkward because the API is not consistent. The structure is different depending on the number of objects and so any code that has to parse that response needs to take that into consideration.
  • 4
    At least it is not givin 500 when no longer authenticated.. :/
  • 1
    Wow what a fuckery...
    They most likely don't even use unittests. 🙈
  • 1
    Have you ever used React? Well, this is the same spec for `props.children`
Add Comment