JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

RFC: Guide for handling generic filter/fieldset errors, such as empty inputs and 'undefined'

Open
#1,452 0 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

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

A JavaScript client has sent a request https://example.com/v1/books/1337?fields[books]=id,undefined
There are various possible approaches to raise a 400 on the invalid fieldset field undefined. It seems reasonable for JR to recommend some options.

Similarly, a JavaScript client has sent a request https://example.com/v1/books/1337?filter[published-on]=undefined
There are various possible approaches to raise a 400 on the invalid filter value undefined. It seems reasonable for JR to recommend some options.

Lastly, there are a number of cases where blank filter inputs can be considered invalid, such as https://example.com/v1/books/1337?filter[published-on]=&fields[books]=id. There are various possible approaches to raise a 400 on the invalid filter value '(empty)'. It seems reasonable for JR to recommend some options.

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

No source files or tests are named; start by reviewing the three example requests in the issue and the linked JSON:API specification. Compare the possible handling of undefined and empty field or filter values, then define an agreed recommendation for when the server should return 400 responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, 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.