arrays inside hash is always missing

Hi team,

the project is running

gem 'dry-configurable', '0.13.0'
gem 'dry-initializer', '3.0.4'
gem 'dry-schema', '1.8.0'
gem 'dry-validation', '1.7.0'

I’ve noticed that whenever I put an array inside a hash, it will always end up with a validation error of the array is missing.
i.g.

class ValidateContract < Dry::Validation::Contract
  params do
    required(:outerHash).hash do
      required(:innerArray).array(:string)
    end
  end
end

Running with example below always give me “innerArray” is missing.

{
  "outerHash": { "innerArray": [ "test1", "test2" ] }
}

This might be an over-simplified example, but its generally a problem I am facing. Is it syntax error from my end? What is going on here.

Please upgrade to the latest dry-schema and verify if it’s still a problem there.

Upgraded to

gem 'dry-configurable', '1.0.1'
gem 'dry-initializer', '3.0.4'
gem 'dry-schema', '1.13.0'
gem 'dry-validation', '1.10.0'

Still seeing the same thing.

Response body: {"error_code":"validation_error","error_message":"parameter validation failed","error_fields":[{"field_name":"outerHash","field_error_messages":{"innerArray":["is missing"]}}]}

I can’t reproduce this:

dry-validation> class ValidateContract < Dry::Validation::Contract
  params do
    required(:outerHash).hash do
      required(:innerArray).array(:string)
    end
dry-validation> class ValidateContract < Dry::Validation::Contract
  params do
    required(:outerHash).hash do
      required(:innerArray).array(:string)
    end
  end
end

=> #<Dry::Schema::Params keys=[{"outerHash"=>["innerArray"]}] rules={:outerHash=>"key?(:outerHash) AND key[outerHash](hash? AND set(key?(:innerArray) AND key[innerArray](array? AND each(str?))))"}>
dry-validation> c = ValidateContract.new
=> #<#<Class:0x000000010581dd40>::ValidateContract schema=#<Dry::Schema::Params keys=[{"outerHash"=>["innerArray"]}] rules={:outerHash=>"key?(:outerHash) AND key[outerHash](hash? AND set(key?(:innerArray) AND key[innerArray](array? AND each(str?))))"}> rules=[]>
dry-validation> h = {
  "outerHash": { "innerArray": [ "test1", "test2" ] }
}
=> {:outerHash=>{:innerArray=>["test1", "test2"]}}
dry-validation> c.(h)
=> #<Dry::Validation::Result{:outerHash=>{:innerArray=>["test1", "test2"]}} errors={}>