zaaack/fable-validation

Type not as expected

Opened this issue · 0 comments

Hi sorry to bother you again, perhaps this library isn't getting a lot of attention, I don't think its been changed in a few years.

// the result type is Result<'T, 'E list>
let result: Result<People, string list> = all <| fun t ->

    { name = t.Test People.Name "abc"
                |> t.MaxLen 20 "maxlen is 20"
                |> t.MinLen 4 "minlen is 4"
                |> t.End
      age = t.Test People.Age 201
                |> t.Gt 0 "should greater then 0"
                |> t.Lt 200 "should less then 200"
                |> t.End }

Assert.AreEqual (result, Error(Map [ People.Name, ["minlen is 4"]
                                     People.Age, ["should less then 200"] ]))

Docs suggest should expect a List of errors but all returns a Map of errors for example
a Map<string, string list>

From my observations I'm getting just a single error in my string list back. This is the behavior I might expect from fast but I'm getting on all.