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

List validation raises an error #18

Open
MMore opened this issue May 15, 2021 · 0 comments
Open

List validation raises an error #18

MMore opened this issue May 15, 2021 · 0 comments

Comments

@MMore
Copy link

MMore commented May 15, 2021

Hello,

I was using your example:

data = %{
  :race => "Khajiit",
  :name => "Bob",
  :level => 6,
  "potions" => "Skooma"
}
schema = %{
  :race => :string,
  :name => :string,
  :level => :int,
  :gender => [:atom, :not_required],
  "potions" => [:list, :string],
}
Skooma.valid?(data, schema)

I've expected getting an {:error, message} tuple but got the following raised error:

** (Protocol.UndefinedError) protocol Enumerable not implemented for "Skooma" of type BitString. This protocol is implemented for the following type(s): Ecto.Adapters.SQL.Stream, Postgrex.Stream, DBConnection.Stream, DBConnection.PrepareStream, HashSet, Range, Map, Function, List, Stream, Date.Range, HashDict, GenEvent.Stream, MapSet, File.Stream, IO.Stream
    (elixir 1.11.4) lib/enum.ex:1: Enumerable.impl_for!/1
    (elixir 1.11.4) lib/enum.ex:141: Enumerable.reduce/3
    (elixir 1.11.4) lib/enum.ex:3473: Enum.reverse/1
    (elixir 1.11.4) lib/enum.ex:3066: Enum.to_list/1
    (elixir 1.11.4) lib/enum.ex:3166: Enum.with_index/2
    (skooma 0.2.0) lib/skooma.ex:74: Skooma.validate_list/3
    (skooma 0.2.0) lib/skooma.ex:12: Skooma.valid?/3
    (elixir 1.11.4) lib/enum.ex:1415: anonymous fn/3 in Enum.map/2
    (stdlib 3.14.1) maps.erl:233: :maps.fold_1/3
    (elixir 1.11.4) lib/enum.ex:2209: Enum.map/2
    (skooma 0.2.0) lib/map.ex:37: Skooma.Map.value_handler/3
    (skooma 0.2.0) lib/map.ex:8: Skooma.Map.validate_map/3
    (skooma 0.2.0) lib/skooma.ex:11: Skooma.valid?/3
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