Skip to content

Commit 4ef2e4e

Browse files
committed
improvement: add support for decimal serialization
1 parent 8e0e9a4 commit 4ef2e4e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/ash_json_api/serializer.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,10 @@ defmodule AshJsonApi.Serializer do
802802
Enum.map(value, &serialize_value(&1, type, constraints[:items] || [], domain, opts))
803803
end
804804

805+
def serialize_value(value, Ash.Type.Decimal, _constraints, _domain, _opts) do
806+
Decimal.to_string(value)
807+
end
808+
805809
def serialize_value(value, type, constraints, domain, opts) do
806810
{type, constraints} = flatten_new_type(type, constraints || [])
807811
opts = [skip_only_primary_key?: false, top_level?: false] |> Keyword.merge(opts)

0 commit comments

Comments
 (0)