       value, _id ->
         value
     end)
-  end
-
-  defp inline_refs(circulars, root, _master, %{schema: schema} = master) do
-    inline_refs(circulars, root, master, schema)
   end
 
   defp inline_refs(circulars, xema) do

              {%Schema{} = ref_schema, root} ->
                inline_refs(circulars, master, root, ref_schema)

              {:root, _root} ->
                schema

              {xema, xema} ->
                schema


  defp map(value, _fun, _id), do: value

  # Returns true if the `reference` builds up a circular reference.
  @spec circular?(struct(), String.t()) :: boolean
  defp circular?(xema, reference),
    do: circular?(xema.refs[reference], reference, xema, [])

