View Source Jsonpatch.Types (Jsonpatch v2.2.0)

Types

Summary

Types

@type casted_array_index() :: :- | non_neg_integer()
@type casted_fragment() :: casted_array_index() | casted_object_key()
@type casted_object_key() :: atom() | String.t()
@type convert_fn() ::
  (fragment :: term(),
   target_path :: [term()],
   target :: json_container(),
   opts() ->
     {:ok, converted_fragment :: term()} | :error)
@type error() :: {:error, error_reason()}
@type error_reason() ::
  {:invalid_spec, String.t()}
  | {:invalid_path, [casted_fragment()]}
  | {:test_failed, String.t()}
@type json_container() :: map() | list()
@type opt_keys() ::
  :strings
  | :atoms
  | {:custom, convert_fn()}
  | {:ignore_invalid_paths, :boolean}

Keys options:

  • :strings (default) - decodes path fragments as binary strings
  • :atoms - path fragments are converted to atoms
  • :atoms! - path fragments are converted to existing atoms
  • {:custom, convert_fn} - path fragments are converted with convert_fn
@type opts() :: [{:keys, opt_keys()}]

Types options:

  • :keys - controls how path fragments are decoded.