Jsonpatch v0.6.1 Jsonpatch.Operation.Test View Source

A test operation in a JSON patch prevents the patch application or allows it.

Link to this section Summary

Functions

Tests if the value at the given path is equal to the provided value.

Link to this section Types

Specs

t() :: %Jsonpatch.Operation.Test{path: String.t(), value: any()}

Link to this section Functions

Specs

apply_op(t(), map()) :: :ok | :error

Tests if the value at the given path is equal to the provided value.

Examples

iex> test = %Jsonpatch.Operation.Test{path: "/x/y", value: "Bob"}
iex> target = %{"x" => %{"y" => "Bob"}}
iex> Jsonpatch.Operation.Test.apply_op(test, target)
:ok