nesaulov/surrealist

Nil values for Boolean type

Closed this issue · 4 comments

Hi, @nesaulov.

It would be nice to allow nil values for attributes of boolean type.

class User
  include Surrealist

  json_schema do
    {
      admin: Bool,
    }
  end
end
Surrealist::InvalidTypeError:
       Wrong type for key `admin`. Expected Bool, got NilClass.

Type definition means only this type and it's subtypes
If you want to use nil or type - you should use Any. Or => you <must!> provide a PR with new type definition dsl :)

0exp commented

@TrumpClone +1
exactly

Wowowow. Hey. You are liars: only Bool cant work with nil. Another types can work with it.
So, @nesaulov! You must fix this ASAP

Yep, you are right