Skip to content
Permalink
Browse files

fixed error raised when expecting list but data is not a list

  • Loading branch information...
chanon committed May 1, 2019
1 parent 371023c commit c53f265ace51eb64073db212912a728661cfbc6f
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/skooma.ex
@@ -69,10 +69,14 @@ defmodule Skooma do
end

defp validate_list(data, schema, path) do
list_schema = Enum.reject(schema, &(&1 == :list))
data
|> Enum.with_index
|> Enum.map(fn({v, k}) -> valid?(v, list_schema, path ++ ["index #{k}"]) end)
if is_list(data) do
list_schema = Enum.reject(schema, &(&1 == :list))
data
|> Enum.with_index
|> Enum.map(fn({v, k}) -> valid?(v, list_schema, path ++ ["index #{k}"]) end)
else
{:error, "Expected list"}
end
end

defp validate_tuple(data, schema, path) do

0 comments on commit c53f265

Please sign in to comment.
You can’t perform that action at this time.