Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Using entities as grape params cause invalid fields?

Open
#211 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start with the params block and Entities::Customer.documentation shown in the issue, then reproduce the POST request that marks every field invalid. Trace how the entity documentation is used for parameter validation; done means identifying the cause and confirming a valid request accepts the intended customer fields.

Written by the indexing model from the issue text.

Description

bug?

Hi this is my code. When I'm using entities as grape params, whenever i do a post request, it returns me name invalid, email invalid, id invalid, etc. Everything is invalid, is there anything i did wrong here? I couldn't find a lot of documentation on this though

desc 'Create a customer.'
params {
requires :none, except: [:name, :email], using: Entities::Customer.documentation.except(:id)
}
post do
present Customer.create! params, with: Entities::Customer
end

class Customer< Grape::Entity
expose :id, documentation: { type: "string" } do |model| model.id.to_s end
expose :name, documentation: { type: "string" }
expose :contact_details do
expose :emailaddress, documentation: { type: "string" }
expose :address, documentation: { type: "string" }
expose :phone, documentation: { type: "string" }
end

Dominant language
Ruby
Stars
730
Forks
155
PR merge metrics
No merged PRs in 30d

Getting set up

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.

More from ruby-grape/grape-entity

All issues in ruby-grape/grape-entity

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.