# `JSV.Ref`
[🔗](https://github.com/lud/jsv/blob/v0.18.3/lib/jsv/ref.ex#L1)

Representation of a JSON Schema reference (`$ref` or `$dynamicRef`).

# `ns`

```elixir
@type ns() :: binary() | :root
```

# `t`

```elixir
@type t() :: %JSV.Ref{arg: term(), dynamic?: term(), kind: term(), ns: term()}
```

# `escape_json_pointer`

```elixir
@spec escape_json_pointer(binary() | iodata()) :: binary()
```

Encodes the given string as a JSON representation of a JSON pointer, that is
with `~` as `~0` and `/` as `~1`.

# `parse`

```elixir
@spec parse(binary(), ns()) :: {:ok, t()} | {:error, term()}
```

Creates a new reference from an URL, relative to the given namespace.

If the URL is absolute and its namespace is different from the given
namespace, returns an absolute URL.

# `parse!`

```elixir
@spec parse!(binary(), ns()) :: t()
```

Raising version of the `parse/2` function.

# `parse_dynamic`

```elixir
@spec parse_dynamic(binary(), ns()) :: {:ok, t()} | {:error, term()}
```

Like `parse/2` but flags the reference as dynamic.

# `pointer`

```elixir
@spec pointer([binary() | integer()], ns()) :: {:ok, t()}
```

Creates a new pointer reference from a list of path segments.

The segments can be strings or integers, representing the path components
of a JSON pointer.

## Examples

    iex> JSV.Ref.pointer(["properties", "name"], :root)
    {:ok, %JSV.Ref{ns: :root, kind: :pointer, arg: ["properties", "name"], dynamic?: false}}

    iex> JSV.Ref.pointer(["items", 0], :root)
    {:ok, %JSV.Ref{ns: :root, kind: :pointer, arg: ["items", 0], dynamic?: false}}

# `pointer!`

```elixir
@spec pointer!([binary() | integer()], ns()) :: t()
```

Creates a new pointer reference from a list of path segments.

Raising version of the `pointer/2` function.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
