-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Milestone
Description
This is a feature for v0.3.x, will use a totally different DSL.
the type option is quite useful for generating documents.
custom Type can be defined like this:
defmodule Maru.Types.Date do
use Maru.Type
def arguments do
[:format]
end
def serialize(output, %{format: "m/d/Y"}) do
...
end
def serialize(output, %{format: "Y-m-d"}) do
...
end
endexpose :age, type: Integer
expose :name, type: fn(instance, _options) ->
"#{instance.firstname} #{instance.lastname}"
end |> String
expose :image, type: fn(instance, _options) ->
File.read!(instance.image_path)
end |> Base64
expose :data, type: Data, format: "m/d/Y"
expose :posts, type: List[PostEntity]Reactions are currently unavailable