Code Monkey home page Code Monkey logo

Comments (5)

LeFnord avatar LeFnord commented on June 9, 2024

mmh … think this is not intended … please can you pack it inito a spec, thanks

from grape-entity.

renatolond avatar renatolond commented on June 9, 2024

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.

renatolond avatar renatolond commented on June 9, 2024

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.

dblock avatar dblock commented on June 9, 2024

@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.

renatolond avatar renatolond commented on June 9, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.