I am following swagger-driven api development. While skimming codebases, i observe that services return a parent object whenever there is an expectation to return a list of objects.
The reason being given is 'it is bad practice to return list of objects in api'. Most likely this popular tutorial is the source of inspiration :- https://www.youtube.com/watch?v=Dmvhe2cw-_k It says 'the api could break if the service returns an object instead of a list'
However, i am not convinced with this one-size-fits-all dictum, since every api contract is documented in swagger and all developers have to strictly follow the document to develop their services and service calls.
I still prefer returning a list of objects over returning a wrapper object. What do the experts suggest ?
Links to any documentation, developer guides for best practices are most appreciated.