JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
Misleading message: "Key is not included in URL"
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
Great gem, but the error message "Key is not included in URL" seems misleading to me for some reasons.
I) It is not clear whar is meant by "key" (I would suggest "id").
II) The message references a concrete problem in the URL, a missing key, which might not be true (e.g. a wrong key might be the problem as well).
III) The error could have happened in the data section as well.
IV) This message is returned whenever something goes wrong with the id (e.g. wrong type of id field in the data section), see example
Example: The following patch request to the correct url (and id) might cause this error message due to an invalid data type (int) for id. It has nothing to do with a "not included" key in the url.
{
data: {
"type": "articles",
"id": 1,
"attributes": {
"title": "updated title"
}
}
}
The request is invalid because of the wrong type (int) for "id". It MUST be string (conforming to json api), and jsonapi-resources correctly refuses to process this request, but with this misleading error message.
Suggestion for this Message: "id field is invalid or does not match the id given in the URL."
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the codebase for the exact message "Key is not included in URL" and trace the validation path exercised by the example payload. Reproduce the invalid integer id case, then update the wording so it describes an invalid or mismatched id and verify the relevant request behavior with the existing tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100