-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GPL-nnn Update jsonapi-resource or investigate alternatives #2857
Comments
I'll push up the 0.10 experimental branch once I've finished running down my current avenue of investigation. |
Hmm, looks like the performance issues I refer to in #2149 might exist anyway. Briefly:
|
Had another crack with json-api-resources 0.10.5 [Edit: ow 0.10.7]. Almost got there with a couple of monkey patches, but running into some major issues with relationships and STI. This branch has the work, along with a couple of added tests to catch edge cases: https://github.com/sanger/sequencescape/tree/json_api_update_v2 Things that didn't work:
I think the trick will be to pull back the sti_type columns, in the pluck for STI relationships and use them,. but that's getting a little larger than I'd like for a monkey patch. Related issues: = Monkey patched = Outstanding |
Looked at https://github.com/stas/jsonapi.rb in context of unified Warehouse:
So not sure I'd suggest a switch, although the simplicity and lack of magic is nice. Also haven't really battle tested it yet against more complicated setup, so its possible that it will run into the same kinds of issues with STI/polymorphisms Had a bit of a poke around at other alternatives, but nothing appears to be in great health. |
This is blocking Rails 6.1 release, so increases in importance |
Looked into this a bit more, and it turns out there is an official fix underway, although it hasn't move much for a while: There's a minor issue with the approach I can see here in that it uses a hard-coded |
We've also now got a new issue with some of the plate creation spec failing, but I think this is just due to the way readonly now works. (Ie. it does, and was previously a little broken) |
User story
We have been stuck on version 0.9.0 of jsonapi-resources for a while, this is mostly as upgrades are causing test failures.
Contributing factors:
app/resources/api/v2/base_resource.rb
config/initializers/patch_json_api_resource.rb
More information on previous depfu attempts to update resources:
#2149
#2035
Attempts to fix earlier 0.9.1 branches (With some success, although the build now appears broken)
https://github.com/JamesGlover/sequencescape/tree/depfu/update/jsonapi-resources-0.9.5
(Inclusions weren't working quite right for relationships, but didn't have a proper chance to investigate more fully.)
Version 0.10 makes some nice improvements, but seems to break has_many 'polymorphic' associations. In particular I was seeing issues with plate relationships. This appears to be because its assuming your polymorphism relates to joins onto different tables, rather than sti. As a result its expecting an association_type column somewhere for building up the relationship data (a combination of type and id). It also seems to expect to see this on labware, which is a little odd. I've made a little progress into fixing some aspects of this, but it does raise questions if this is the right gem. (I had thought it was abandoned, but instead it seems to just get updates somewhat sporadically)
Unfortunately heavy use of sti and polymorphic associations do limit our options a little.
Who are the primary contacts for this story
e.g. John S (don't include surnames in public repos)
Acceptance criteria
To be considered successful the solution must allow:
Dependencies
This story is blocked by the following dependencies:
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: