Using entities as grape params cause invalid fields?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
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
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
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
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.
More from ruby-grape/grape-entity
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
ruby-grape/grape-entity#386 · 7 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
ruby-grape/grape-entity#382 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
ruby-grape/grape-entity#380 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
ruby-grape/grape-entity#373 · 2 comments ·
-
Truncate FormatterOpen
Difficulty 1/5 1-3 hours Newbie friendliness 45/100
ruby-grape/grape-entity#372 ·
All issues in ruby-grape/grape-entity
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
eurosky-social/eu-haul#32 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
benbalter/add-to-org#17 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
benbalter/change_agent#11 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
benbalter/count-org-loc#20 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
benbalter/sitemap-parser#33 ·