Skip to content

A single value where a list is expected raises an error #22

@amclain

Description

@amclain

A list with a single value throws an error. This should probably return :wrong_type (possibly :not_a_list to avoid confusion between the type and its wrapper).

struct Message

name "message"

attribute :ints, [:integer], optional: true
iex(2)> Speck.validate(Message, %{ints: 1})

** (Protocol.UndefinedError) protocol Enumerable not implemented for type Integer.
This protocol is implemented for the following type(s): Date.Range, File.Stream,
Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Range, Stream

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions