gjaldon / ecto_enum

Ecto extension to support enums in models
MIT License
563 stars 131 forks source link

Nullable fields not being handled correctly. #105

Open sdost opened 4 years ago

sdost commented 4 years ago

In our MySQL table the enum field is nullable by default. When the nil is received from a query, it is passed into the load/1 function, which is only expecting the values of the enum, and does not handle a nil value.

Request: POST /graphql
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in BusinessType.load/1
        (emporos) lib/emporos/models/stripe/business_type.ex:3: BusinessType.load(nil)

I would expect that the nil should just get passed through to nil from the load/1 function.