# `Skir.RPC.TypeDescriptor`
[🔗](https://github.com/gepheum/skir/blob/main/lib/skir/rpc/type_descriptor.ex#L1)

Builds, serializes, and parses the self-describing type JSON used by Skir reflection,
SkirRPC's `list` endpoint, and Skir Studio.

# `t`

```elixir
@type t() :: %Skir.RPC.TypeDescriptor{records: [map()], type: map()}
```

# `from_json`

```elixir
@spec from_json(binary()) :: {:ok, t()} | {:error, String.t()}
```

Parses a `%Skir.RPC.TypeDescriptor{}` from a UTF-8 JSON string.

# `from_json!`

```elixir
@spec from_json!(binary()) :: t()
```

Like `from_json/1`, but raises `ArgumentError` on failure.

# `from_map`

```elixir
@spec from_map(map()) :: {:ok, t()} | {:error, String.t()}
```

Parses a `%Skir.RPC.TypeDescriptor{}` from a decoded JSON map.

# `from_map!`

```elixir
@spec from_map!(map()) :: t()
```

Like `from_map/1`, but raises `ArgumentError` on failure.

# `from_type`

```elixir
@spec from_type(Skir.type()) :: t()
```

Builds a `%Skir.RPC.TypeDescriptor{}` from a `Skir.type()`.

# `to_json`

```elixir
@spec to_json(Skir.type() | t()) :: binary()
```

Returns the 2-space pretty-printed JSON string for a `Skir.type()` or `%Skir.RPC.TypeDescriptor{}`.

# `to_map`

```elixir
@spec to_map(Skir.type() | t()) :: map()
```

Returns a JSON-compatible map representation of a `Skir.type()` or `%Skir.RPC.TypeDescriptor{}`.

---

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