# `DocShell.Presentation.HostedPair`
[🔗](https://github.com/futhr/doc_shell/blob/v2.0.0/lib/doc_shell/presentation/hosted_pair.ex#L1)

Checks one host-admitted narrative/OpenAPI publication before rendering.

The presentation's optional `publication` field and the OpenAPI extension
`x-doc-shell-publication` carry identical string-keyed bindings. A binding has
schema `doc-shell-publication/v1` and nonempty opaque `publication_id`,
`source_view`, `graph_position`, `locale`, `release`, and `disclosure_surface`
strings. Every field must also match the expected binding supplied by the
host for this request. Thus two mutually consistent but stale inputs still
fail when the host expects another publication.

The host authenticates the request, admits both inputs and declares the
expected view. This module compares those declarations and validates the
existing presentation/OpenAPI shapes. It neither authenticates a binding nor
discovers repositories, fetches sources, constructs collections or filters
private content. Reusing a binding for altered source data violates the host's
immutable-publication contract; equality is not proof of source authenticity.

# `binding`

```elixir
@type binding() :: %{required(String.t()) =&gt; String.t()}
```

Host-declared immutable publication identity, with no authorization authority.

# `t`

```elixir
@type t() :: %{
  publication: binding(),
  presentation: DocShell.Presentation.Source.presentation(),
  openapi: map()
}
```

Validated inputs retained together for one renderer call.

# `validate`

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

Admits a typed graph presentation and OpenAPI document against the requested view.

Bindings are required on both inputs and in `expected`. Shape validation and
comparison complete before an `{:ok, pair}` is returned. Errors identify the
input and mismatched field without returning its potentially private value.

# `validate_binding`

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

Validates a closed publication binding and its finite opaque fields.

---

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