Craft GraphQL APIs in Elixir with Absinthe Part Five

I am now onto the mutations chapter.

It seems that Decimal has changed it’s parse return. It used to be {:ok, decimal} but is now {decimal, remainder} which means that you will need the following to get Chapter 5 to build:

  scalar :decimal do
    parse fn
      %{value: value}, _ ->
        {d,_} = Decimal.parse(value)
        {:ok, d}
      _, _ ->
        :error
    end
    serialize &to_string/1
  end

Leave a comment