Comments (5)
mmh … think this is not intended … please can you pack it inito a spec, thanks
from grape-entity.
Here is a spec that shows the issue:
# frozen_string_literal: true
require 'spec_helper'
describe 'Nested arguments with the same name' do
class User < Grape::Entity
expose :name
expose :email
expose :work do
expose :company
expose :email
end
end
let(:attributes) do
{
name: 'River Song',
email: '[email protected]',
work: {
company: 'Song Ltd',
email: '[email protected]'
}
}
end
describe '#represent' do
it 'the represented json should match the original hash' do
expect(JSON.parse(User.represent(attributes).to_json, symbolize_names: true)).to eq(attributes)
end
end
end
from grape-entity.
Hey folks :)
We were wondering if there's some bounty program you work with that could help finance the project and fix specific issues and if so which one? We would be willing to put up a bounty for this issue.
from grape-entity.
@renatolond it's nice of you to offer! You probably will have better success hiring a developer on your side to fix the issues you care most about, maintainers here are pretty responsive to good PRs.
from grape-entity.
Hi!
I started working on a PR to fix this but realized there was a test for this already, I just had misunderstood the docs. This spec does what I was trying to do: https://github.com/ruby-grape/grape-entity/blob/master/spec/grape_entity/hash_spec.rb#L23-L29
Thanks again for the attention and sorry for the issue!
from grape-entity.
Related Issues (20)
- benchmark
- How to get the specified expose
- Adding default value to expose
- Version 0.8 compatibility with grape 1.3.1 HOT 3
- Why docs suggest strings for root option? HOT 1
- Sending an array of hash HOT 1
- Proxy API modeling HOT 1
- Grape::Entity#as_json does not return a recursive set of hashes.
- Ruby 3: Entities exposing fields via Symbol#to_proc are broken HOT 3
- Frozen/Deadlocked Ruby thread instead of NoMethodError HOT 1
- expose_nil option doesn't respect Entity.hash_access
- Inheritance issue with the entity HOT 2
- Inheritance issue with the grape-entity version >= 0.5.0
- `FetchableObject` can cause unexpected behavior HOT 4
- Override Grape Entity Model Description
- Truncate Formatter
- Expose default value doesn't work for me HOT 2
- `expose_nil:` conflicts with options passing to a block
- `route.entity` can not get entity class in Rails 7.1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grape-entity.