defmodule Person do
defstruct ~w(name)a
end
defmodule PersonSerializer do
use Blazon.Serializable
field name, :string
field gender, enum: [type: :gender, ~w(male female)a], via: fn (person) ->
if String.contains?("John")
:male
else
:female
end
end
end
Given something like,
We should produce an intermediate form like so:
This will allow more structured serializers i.e.
xml
to provide proper type semantics.