JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Compatibility with JSONAPI::Authorization (Resource Caching)

Open
#1,177 1 comment 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.3k
Forks
546
PR merge metrics
No merged PRs in 30d

Description

This issue is a (choose one):

  • Feature request.

Checklist before submitting:

  • I've searched for an existing issue.
  • The feature I'm asking for is compliant with the JSON:API spec.

Description

JSONAPI::Authorization is a pundit based authorization tool that works out-of-the-box with jsonapi-resources' ActiveRecord backed resources.
The problem is with Cached Resource as it does not have a model key.

JSONAPI::Authorization's related issue https://github.com/venuu/jsonapi-authorization/issues/67

Features:

Exposing the original model into cache in CachedResourceFramgment(https://github.com/cerebris/jsonapi-resources/blob/master/lib/jsonapi/cached_response_fragment.rb#L87) would solve the problem easily – not sure about the cons.

I have a working solution in my fork so I can submit a PR If you are OK with the idea.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at lib/jsonapi/cached_response_fragment.rb around line 87 and review how Cached Resource currently represents the resource. Check the linked JSONAPI::Authorization issue and the reported fork solution, then determine whether exposing the original model resolves the missing model key without adverse effects. Done means Cached Resource works with JSONAPI::Authorization resource caching.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.