JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Custom Operations

Open
#330 1 comment 1 reaction 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

As per discussed in #129, I would like to do other tasks within a CRUD operation.

For my specific use case, I would like to create related resources upon creating a parent resource. The API is still strictly CRUD and compliant with JSONAPI, but under the hood I would like to have business logic that lives on the server side rather than the client. I found that decoupling this sort of code into service objects have been great for testing and maintainability, and it looks like Operation is exactly that.

Perhaps we can refactor it such that users of this gem can write their own operations for specific resources?

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 with the discussion in #129 and the existing Operation abstraction to understand how CRUD requests are currently handled. Define what an extension point for resource-specific operations would need to support, including creating related resources while keeping the external API CRUD-based and JSON:API-compliant; completion should include a maintainable service-object approach and evidence that the behavior is testable.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.