Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong error message when use hash of array of hashes #576

Open
dluhhbiu opened this issue Jun 14, 2024 · 0 comments
Open

Wrong error message when use hash of array of hashes #576

dluhhbiu opened this issue Jun 14, 2024 · 0 comments

Comments

@dluhhbiu
Copy link

dluhhbiu commented Jun 14, 2024

Hello. I realized when use hash of array of hash then got wrong error message

class TestArrayOfHashes < ActiveInteraction::Base
  hash :data do
    array :test do
      hash do
        string :value
        string :value2
      end
    end
  end

  def execute
    inputs
  end
end

When I run next code, I get correct response

# code
TestArrayOfHashes.run!(data: { test: [{ value: 'foo', value2: 'bar' }] })
# response
{:data=>{"test"=>[{"value"=>"foo", "value2"=>"bar"}]}}

But next part of code works incorrect like my opinion

# code
TestArrayOfHashes.run!(data: { test: [{ value: 'foo', wrong_value: 'foo' }] })
# response
Data test required (ActiveInteraction::InvalidInteractionError)

Error is correct, but I expected something like Data test value2 required

Is it bug or correct behavior?

Version of gem active_interaction (5.3.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant