jsonapi.rb icon indicating copy to clipboard operation
jsonapi.rb copied to clipboard

Support deserialization for data collections

Open rdnewman opened this issue 4 years ago • 0 comments

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:

  • [X] Tests for the changes have been added (for bug fixes / features)
  • [X] Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • [x] All automated checks pass (CI/CD)

rdnewman avatar Sep 29 '21 19:09 rdnewman