Throw exception if collection is empty
alireza-milani opened this issue · 2 comments
alireza-milani commented
Hope you're well
If list of data is empty, your library couldn't detects type of data and throw and exception.
Could you please find a solution for this situation
stjepanbanek commented
It's expected behaviour, although we should maybe rethink the exception throwing. The lib relies on the type
parameter to determine the data type to deserialize. By the JSON:API specification, empty lists shouldn't be sent by the backend. Instead the key of the empty value should be omitted in the output.
That being said, I will look into what we can do about that exception. In the meantime, I suggest modelling the backend to skip sending keys with empty values
stjepanbanek commented
Also, thanks for your feedback @alireza-milani we really appreciate it!