@@ -104,19 +104,7 @@ defmodule Ash.Changeset do
104104 defimpl Inspect do
105105 import Inspect.Algebra
106106
107- @ spec inspect ( Ash.Changeset . t ( ) , Inspect.Opts . t ( ) ) ::
108- { :doc_cons , :doc_line | :doc_nil | binary | tuple ,
109- :doc_line | :doc_nil | binary | tuple }
110- | { :doc_group ,
111- :doc_line
112- | :doc_nil
113- | binary
114- | { :doc_collapse , pos_integer }
115- | { :doc_force , any }
116- | { :doc_break | :doc_color | :doc_cons | :doc_fits | :doc_group | :doc_string , any ,
117- any }
118- | { :doc_nest , any , :cursor | :reset | non_neg_integer , :always | :break } ,
119- :inherit | :self }
107+ @ spec inspect ( Ash.Changeset . t ( ) , Inspect.Opts . t ( ) ) :: Inspect.Algebra . t ( )
120108 def inspect ( changeset , opts ) do
121109 context = Map . delete ( changeset . context , :private )
122110
@@ -526,21 +514,22 @@ defmodule Ash.Changeset do
526514 context = Ash.Resource.Info . default_context ( resource ) || % { }
527515
528516 if Ash.Resource.Info . resource? ( resource ) do
529- % __MODULE__ { resource: resource , data: record , action_type: action_type }
517+ new_changeset ( resource , record , action_type )
530518 |> set_context ( context )
531519 |> set_tenant ( tenant )
532520 else
533- % __MODULE__ {
534- resource: resource ,
535- action_type: action_type ,
536- data: struct ( resource )
537- }
521+ new_changeset ( resource , struct ( resource ) , action_type )
538522 |> add_error ( NoSuchResource . exception ( resource: resource ) )
539523 |> set_tenant ( tenant )
540524 |> set_context ( context )
541525 end
542526 end
543527
528+ @ spec new_changeset ( Ash.Resource . t ( ) , term ( ) , atom ( ) ) :: t ( )
529+ defp new_changeset ( resource , data , action_type ) do
530+ % __MODULE__ { resource: resource , data: data , action_type: action_type }
531+ end
532+
544533 @ doc """
545534 Ensure that only the specified attributes are present in the results.
546535
0 commit comments