JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
More Helpful Error Messages for Relationship Type Mismatches
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
I encountered the following error today: "{"errors":[{"title":"Type Mismatch","detail":"category is not a valid type for this operation.","code":"116","status":"400"}]}". My Ingredient resources has a belongs-to relationship to Category. Eventually through Dan Gebhardt's help I came to realize that I should have been using the plural name of the resource in my request.
It'd be nice to have a more helpful error message when such an error occurs. Imagine my error message also included a list of valid types, e.g. "Valid types include 'categories', 'cars', 'sith-lords'." Perhaps this would only apply in dev mode, though it may not hurt in prod too.
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
The issue does not name a file, test, or entry point. Start by locating the error path that handles invalid relationship resource types and inspect related error-response tests. Done means the mismatch response identifies valid resource types, with the development-versus-production behavior resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100