This repository tries to illustrate an issue / question with Hanami 0.8 with dry-validation and a request param like this:
{
data: {
attributes: {
email: '[email protected]',
password: 'secret',
alternative_emails: [
{email: "[email protected]", description: "work"},
{email: "[email protected]", description: "home"}
]
}
}
}
After the params is validated in the controller the alternative_emails
becomes String
, and not expected Hash
.
Please see the following files:
spec/web/controllers/user/create_spec.rb
- Simply calling action with params, expecting params to be returned in response.apps/web/controllers/user/create.rb
- The action and comments describing three attempts I did to get the expected behavior.
I have tried to figure it out by looking at the following pages: