DocShell.Presentation.HostedPair (DocShell v2.0.0)

Copy Markdown View Source

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.

Summary

Types

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

t()

Validated inputs retained together for one renderer call.

Functions

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

Validates a closed publication binding and its finite opaque fields.

Types

binding()

@type binding() :: %{required(String.t()) => String.t()}

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

t()

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

Validated inputs retained together for one renderer call.

Functions

validate(presentation, openapi, expected)

@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(binding)

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

Validates a closed publication binding and its finite opaque fields.