JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Id is required for update of singular resource.

Open
#976 2 comments 0 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

Hello. In my case I send put request to /profile route. And since this resource is singular, I don't need to provide id param. But, unfortunately, it throws A key is required error if I don't provide id(it works if I provide any random value as id).

It happens because of this line of code
https://github.com/cerebris/jsonapi-resources/blob/master/lib/jsonapi/request_parser.rb#L201

Are the any specific reasons for this behaviour?

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

Read lib/jsonapi/request_parser.rb around line 201 and trace how a PUT request to the singular /profile resource is parsed. Reproduce the missing-id and arbitrary-id cases, then determine whether the current key requirement is intentional. Done means the expected behavior and its reason are established, with a regression test if the behavior should change.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.