@@ -176,12 +176,15 @@ defmodule Kaffy.ResourceSchema do
176176 value . ( schema )
177177
178178 is_map ( value ) && Map . has_key? ( value , :__struct__ ) ->
179- if value . __struct__ in [ NaiveDateTime , DateTime , Date , Time ] do
180- value
181- else
182- Map . from_struct ( value )
183- |> Map . drop ( [ :__meta__ ] )
184- |> Kaffy.Utils . json ( ) . encode! ( escape: :html_safe , pretty: true )
179+ cond do
180+ value . __struct__ in [ NaiveDateTime , DateTime , Date , Time ] ->
181+ value
182+ value . __struct__ in [ Geo.Point ] ->
183+ Kaffy.Utils . json ( ) . encode! ( value , escape: :html_safe , pretty: true )
184+ true ->
185+ Map . from_struct ( value )
186+ |> Map . drop ( [ :__meta__ ] )
187+ |> Kaffy.Utils . json ( ) . encode! ( escape: :html_safe , pretty: true )
185188 end
186189
187190 Kaffy.Utils . is_module ( ft ) && Keyword . has_key? ( ft . __info__ ( :functions ) , :render_index ) ->
@@ -206,12 +209,15 @@ defmodule Kaffy.ResourceSchema do
206209 value
207210
208211 is_map ( value ) && Map . has_key? ( value , :__struct__ ) ->
209- if value . __struct__ in [ NaiveDateTime , DateTime , Date , Time ] do
210- value
211- else
212- Map . from_struct ( value )
213- |> Map . drop ( [ :__meta__ ] )
214- |> Kaffy.Utils . json ( ) . encode! ( escape: :html_safe , pretty: true )
212+ cond do
213+ value . __struct__ in [ NaiveDateTime , DateTime , Date , Time ] ->
214+ value
215+ value . __struct__ in [ Geo.Point ] ->
216+ Kaffy.Utils . json ( ) . encode! ( value , escape: :html_safe , pretty: true )
217+ true ->
218+ Map . from_struct ( value )
219+ |> Map . drop ( [ :__meta__ ] )
220+ |> Kaffy.Utils . json ( ) . encode! ( escape: :html_safe , pretty: true )
215221 end
216222
217223 is_map ( value ) ->
@@ -320,6 +326,9 @@ defmodule Kaffy.ResourceSchema do
320326 { _f , % { type: { :array , _ } } } ->
321327 true
322328
329+ { _f , % { type: Geo.PostGIS.Geometry } } ->
330+ true
331+
323332 f when is_atom ( f ) ->
324333 f == :map
325334
0 commit comments