# `Backplane.Schema.JSONSchema.Encoder`

Encodes a Backplane.Schema schema definition into a JSON Schema (Draft 7) map.

References use Draft 7 `definitions` pointers. A matching `$defs` alias is
emitted for compatibility with schemas produced by earlier Backplane.Schema versions.

Field-level metadata attached via `{:meta, type, opts}` is read during
encoding and surfaced as JSON Schema annotation/format keywords. See
`@meta_keys` for the recognised vocabulary; unknown keys are dropped.

Dynamic Backplane.Schema types (`:dependent`, `:cond`, `:custom`) cannot be expressed
statically. The `:on_unsupported` option controls the fallback:

  - `:omit` (default) — emit `%{}` (true schema)
  - `:true_schema` — same as `:omit`
  - `:raise` — raise `Backplane.Schema.JSONSchema.Encoder.UnsupportedTypeError`

The `:exclude_meta_keys` option drops listed annotation keywords from the
output. Accepts any subset of the meta vocabulary plus `:default`. Useful
when emitting consumer-facing JSON Schema where `default` values are
validation-only and should not be exposed.

Top-level keyword-list schemas are encoded as objects. Required/coercion
options and named-schema annotations are Backplane.Schema-only and omitted; coercion
wrappers encode their target. `:atom` and `:atom!` both encode as strings.
Refs use Draft 7 `definitions` pointers and include a `$defs` alias.

    Backplane.Schema.to_json_schema(schema, exclude_meta_keys: [:default])

Prefer `Backplane.Schema.to_json_schema/2` as the public entry point.

# `opts`

```elixir
@type opts() :: [
  on_unsupported: :omit | :true_schema | :raise,
  exclude_meta_keys: [atom()]
]
```

# `encode`

```elixir
@spec encode(Backplane.Schema.schema(), opts()) :: map()
```

---

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