# `JSONSchex.ScopeScanner`
[🔗](https://github.com/xinz/jsonschex/blob/main/lib/jsonschex/scope_scanner.ex#L1)

Scans a raw schema tree to discover all `$id`, `$anchor`, and `$dynamicAnchor`
definitions, resolving them against parent base URIs to build a registry of
absolute URI → raw schema mappings.

The resulting registry is used by `JSONSchex.Compiler` to populate the `defs`
field in the compiled `Schema`, enabling reference resolution during validation.

## Examples

    iex> schema = %{
    ...>   "$id" => "https://example.com/schema",
    ...>   "$defs" => %{
    ...>     "user" => %{"$id" => "user", "type" => "object"}
    ...>   }
    ...> }
    iex> registry = JSONSchex.ScopeScanner.scan(schema)
    iex> Map.has_key?(registry, "https://example.com/schema")
    true
    iex> Map.has_key?(registry, "https://example.com/user")
    true

# `scan`

Scans a raw schema and returns a tuple `{registry, refs}` where:
- `registry` is a map of `{absolute_uri => raw_schema}`.
- `refs` is a MapSet of explicitly defined references.

# `scan_all`

Scans every map/list node in a containing document for JSON Schema resource
identifiers and references.

This is intentionally broader than `scan/1`: fragment compilation may receive
an OpenAPI document whose schema objects live under arbitrary paths such as
`components.schemas` or `paths.*.requestBody.content.*.schema`.

---

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