stas / jsonapi.rb

Lightweight, simple and maintained JSON:API support for your next Ruby HTTP API.
MIT License
262 stars 58 forks source link

Support deserialization for data collections #68

Open rdnewman opened 3 years ago

rdnewman commented 3 years ago

What is the current behavior?

When deserializing (via JSON::Deserialization, #jsonapi_deserialize.call) a document where :data is an array of resources, it fails because it assumes a single resource. The error occurs on Line 52 of jsonapi.rb/lib/jsonapi/deserialization.rb.

What is the new behavior?

jsonapi_deserialize.call now supports cases where :data is an array. Each element of the array will be deserialized in the same manner as when :data is a single resource. Cases where :data is not an array are unchanged.

Checklist

Please make sure the following requirements are complete: