infinite loop when using "format" as field name
In dsl.ex, if you have :format as attribute
def default_attributes(serializer, struct, conn) do serializer.__attributes |> Enum.map(&({&1, apply(serializer, &1, [struct, conn])}))
you get
warning: Elixir.MyApp.V1.PhotoView.format/3 is deprecated. Please use JaSerializer.format/4 instead, eg: JaSerializer.format(Elixir.MyApp.V1.PhotoView, data, conn, opts)
and it seems to infinitely loop
This will be fixed with 1.0.0 when we remove the deprecated function.
In the meantime, how can you workaround it to use format as an attribute name?
@coneybeare you can use the attributes/2 callback to serialize any conflicting keywords like format:
defmodule MySerializer do
def attributes(record, _conn) do
Map.take(record, [:format])
end
end