sequencescape icon indicating copy to clipboard operation
sequencescape copied to clipboard

Y24-213 - Remove use of `default_includes` in API v2 resources and the underlying support for it

Open sdjmchattie opened this issue 7 months ago • 0 comments

Summary

A decent number of our JSONAPI::Resources use default_includes for things like :uuid_object and this probably worked 7 years ago when it was added, but this is no longer true.

What are we doing?

In many resources, one example of which is PlateTemplateResource, we are using a method which we added to BaseResource to record which related records we should include when a request is made for the resource. These default includes are then recorded via an inclusions method and used to modify the behaviour of apply_includes which JSONAPI::Resources is supposed to call when it wants to find out which related resources to include in a response.

How do we know it's no longer needed?

As can be seen in the upgrade checker rake task for JSONAPI::Resources, they no longer call the apply_includes method which is the core of our default_includes functionality. So our implementation does nothing.

What needs to happen?

  • Strip out all the code from BaseResource that handles the storing of default_includes and directs it through to the override of apply_includes. We should not be overriding that deprecated method any more.
  • Remove default_includes from any resources that are specifying it.
  • Check every one of those resources to ensure that the response is unchanged after the above changes.

sdjmchattie avatar Jul 25 '24 14:07 sdjmchattie