# `AttestoMCP.Server.Schema`
[🔗](https://github.com/XukuLLC/attesto_mcp_server/blob/v2.8.0/lib/attesto_mcp_server/schema.ex#L1)

Bounded JSON Schema 2020-12 and draft-07 validation.

JSV evaluates the declared dialect, including reference scope and evaluation
annotations. Network resolvers and data casting are disabled. Format
assertions remain enabled for compatibility; pass `formats: false` to use
the dialect's format annotation semantics. Defaults remain annotations unless
explicitly applied.

# `apply_property_defaults`

```elixir
@spec apply_property_defaults(map(), map() | boolean(), keyword()) ::
  {:ok, map()} | {:error, term()}
```

Applies bounded, direct JSON Schema property defaults and validates the result.

Only defaults reached through literal `properties` entries are applied. The
helper recurses into existing object properties and objects supplied by an
explicit property default. It does not infer defaults through references,
combinators, conditionals, array items, or pattern properties, and it never
creates an absent parent object unless that property declares its own
`default`.

Presence is determined with `Map.has_key?/2`, so `nil`, `false`, zero, and an
empty string are never replaced. At most 500 defaults are applied, and the
completed value must satisfy the normal depth, node, byte, and schema bounds.
Server dispatch never calls this helper automatically.

# `default_instance_bytes`

# `export_dialect`

```elixir
@spec export_dialect(term()) :: term()
```

Returns an exported schema root with the default dialect made explicit.

An object schema without `$schema` receives the canonical JSON Schema
2020-12 identifier, which is the dialect the validator already applies. An
explicit `$schema`, a boolean schema, and every nested value are returned
unchanged.

# `json_value`

```elixir
@spec json_value(
  term(),
  keyword()
) :: :ok | {:error, :not_json}
```

Checks that a term can be represented losslessly as JSON.

# `max_allowed_instance_bytes`

# `max_instance_bytes`

# `min_allowed_instance_bytes`

# `supported_dialects`

```elixir
@spec supported_dialects() :: [String.t()]
```

Returns the dialects accepted in an explicit `$schema` declaration.

# `validate`

```elixir
@spec validate(term(), term(), keyword()) :: :ok | {:error, term()}
```

Validates the original JSON instance without casting or inserting defaults.

# `validate_modern_result`

```elixir
@spec validate_modern_result(
  map(),
  keyword()
) :: :ok | {:error, term()}
```

Validates the bounded modern result variants emitted by this package.

# `validate_schema`

```elixir
@spec validate_schema(
  term(),
  keyword()
) :: :ok | {:error, term()}
```

Checks the schema's declared dialect without fetching network references.

---

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