Skip to content

Conversation

@mariokostelac
Copy link

I've recently spent several hours debugging a problem that was caused by an empty hash definition

required do
   hash :hash_name
end

Such definition discards any hash content being passed in, which is very
confusing and I reckon rarely useful, but very unintuitive interface
(found other 3 bugs in the codebase caused by the exact same problem).

This change makes such definitions raise, but only if
Mutations.raise_on_empty_hash_filter is set to true (defualt false).
Such optional raising avoids breaking change.

Overall, I recommend changing the interface to raise on bogus definition
as a default, instead of the opt-in.

I've recently spent several hours debugging a problem that was caused by an empty hash definition
```ruby
required do
   hash :hash_name
end
```

Such definition discards any hash content being passed in, which is very
confusing and I reckon rarely useful, but very unintuitive interface
(found other 3 bugs in the codebase caused by the exact same problem).

This change makes such definitions raise, but only if
Mutations.raise_on_empty_hash_filter is set to true (defualt false).
Such optional raising avoids breaking change.

Overall, I recommend changing the interface to raise on bogus definition
as a default, instead of the opt-in.
@mariokostelac mariokostelac force-pushed the mario/raise_on_empty_hash branch from f81a8e9 to d245226 Compare August 5, 2021 07:17
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

Successfully merging this pull request may close these issues.

1 participant