We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The in? predicate raises an exception when the list contains a single element.
in?
defmodule Contract do use Drops.Contract schema do %{ optional(:side) => string(in?: ["salad"]), optional(:meat) => string(in?: ["chicken", "beef"]) } end end Contract.conform(%{meat: "chicken"}) # => {:ok, %{meat: "chicken"}} Contract.conform(%{side: "salad"}) # ** (FunctionClauseError) no function clause matching in Drops.Predicates.in?/2 # # The following arguments were given to Drops.Predicates.in?/2: # # # 1 # "salad" # # # 2 # "salad" # # Attempted function clauses (showing 1 out of 1): # # def in?(list, input) when is_list(list) # # (drops 0.2.0) lib/drops/predicates.ex:377: Drops.Predicates.in?/2 # (drops 0.2.0) lib/drops/predicates/helpers.ex:22: Drops.Predicates.Helpers.apply_predicate/2 # (elixir 1.17.1) lib/enum.ex:2531: Enum."-reduce/3-lists^foldl/2-0-"/3 # (drops 0.2.0) lib/drops/types/map/key.ex:15: Drops.Types.Map.Key.validate/2 # (elixir 1.17.1) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2 # (elixir 1.17.1) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2 # (drops 0.2.0) lib/drops/types/map.ex:63: Drops.Types.Map.Validator.validate/2 # iex:6: Contract.conform/3
The text was updated successfully, but these errors were encountered:
Ah thanks for reporting this. I'll fix it in the next release sometime next week :)
Sorry, something went wrong.
Handle in? and not_in? with a single element list
d8fa778
Fixes #55
4aebadc
solnic
Successfully merging a pull request may close this issue.
The
in?
predicate raises an exception when the list contains a single element.The text was updated successfully, but these errors were encountered: