ruby-grape / ruby-grape/grape

ArgumentError: coerce_with disallowed for type: JSON

Open
#1,653 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
Ruby
Stars
10k
Forks
1.2k
Avg merge
14h 38m
Merged PRs (30d)
92

Description

If I want, for instance, to use Oj library to parse JSON, grape does not allow me to do so.

requires :json, type: Array[JSON], coerce_with: ->(raw) { Oj.load(raw) }

What are the reasons for that? Maybe we can allow custom coercions for JSON?

Contributor guide

Open the contributing guide

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 by tracing how Grape handles requires :json, type: Array[JSON], coerce_with: and why the supplied Oj.load coercion is rejected. The issue names no files or tests; done would require an agreed behavior for allowing or rejecting custom coercions for JSON and coverage for that behavior.

Written by the indexing model from the issue text.

Assessment

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