# `A2UIAgent.Express.SchemaHelper`
[🔗](https://github.com/a2ui-elixir/a2ui/blob/v0.1.1/umbrella/apps/a2ui_agent/lib/a2ui_agent/express/schema_helper.ex#L1)

What Express reads from a catalog: each component's properties in
positional order, each function's parameters, and the facts about a
property's schema that decide how an argument compiles.

A component's positional order is its own properties in the order its
schema declares them, then the properties it inherits through `allOf`,
leaving out `id`, `component` and `catalogId`. A component can take
checks when it declares a property holding a list of `CheckRule`s, or
inherits one from a common type such as `Checkable`; an inherited
check property comes last.

The helper reads the catalog document (`A2UICore.Catalog.to_json/2`,
in the order it was read) with its local and peer references written
inline, and resolves references to the common types against the common
types of the protocol version it is built for.

# `t`
*since 0.1.0* 

```elixir
@type t() :: %A2UIAgent.Express.SchemaHelper{
  catalog: A2UICore.Catalog.t(),
  catalog_id: String.t(),
  check_properties: %{optional(String.t()) =&gt; String.t()},
  common_defs: term(),
  component_names: [String.t()],
  component_properties: %{optional(String.t()) =&gt; [String.t()]},
  component_required: %{optional(String.t()) =&gt; [String.t()]},
  components: %{optional(String.t()) =&gt; term()},
  document: term(),
  function_names: [String.t()],
  function_properties: %{optional(String.t()) =&gt; [String.t()]},
  function_required: %{optional(String.t()) =&gt; [String.t()]},
  functions: %{optional(String.t()) =&gt; term()},
  inherited_check_schemas: %{optional(String.t()) =&gt; term()},
  keys: %{path: String.t(), call: String.t()},
  property_enums: %{optional({String.t(), String.t()}) =&gt; list()}
}
```

# `action_slot?`
*since 0.1.0* 

```elixir
@spec action_slot?(term()) :: boolean()
```

Whether a property takes an action: its schema refers to the common
`Action` type, directly or through `allOf`, `oneOf` or `anyOf`.

# `admits_path?`
*since 0.1.0* 

```elixir
@spec admits_path?(t(), term()) :: boolean()
```

Whether a value written for `schema` may be a data binding: the
schema, or one it reaches through `$ref`, `allOf`, `oneOf` or `anyOf`,
is an object schema with a `path` or `@path` property.

# `build_all`
*since 0.1.0* 

```elixir
@spec build_all([A2UICore.Catalog.t()], String.t()) :: [t()]
```

The helpers for `catalogs`, in order, built for protocol `version`.
The catalogs are first linked to each other
(`A2UICore.Catalog.link_catalogs/1`), so that references between them
resolve.

# `check_property`
*since 0.1.0* 

```elixir
@spec check_property(t(), String.t()) :: String.t() | nil
```

The property a component's checks go in, or `nil` if it takes none.

# `common_def_name`
*since 0.1.0* 

```elixir
@spec common_def_name(term()) :: String.t() | nil
```

The name of the common type a `$ref` points to
(`common_types.json#/$defs/<Name>`, also as an absolute URL or under
`definitions`), or `nil`.

    iex> A2UIAgent.Express.SchemaHelper.common_def_name("common_types.json#/$defs/Action")
    "Action"
    iex> A2UIAgent.Express.SchemaHelper.common_def_name("#/$defs/Action")
    nil

# `component?`
*since 0.1.0* 

```elixir
@spec component?(t(), String.t()) :: boolean()
```

Whether the catalog defines component `name`.

# `component_description`
*since 0.1.0* 

```elixir
@spec component_description(t(), String.t()) :: String.t() | nil
```

A component's description, from its schema or the first `allOf` member that has one.

# `component_properties`
*since 0.1.0* 

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

A component's properties in positional order.

# `component_required`
*since 0.1.0* 

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

The properties a component requires.

# `function?`
*since 0.1.0* 

```elixir
@spec function?(t(), String.t()) :: boolean()
```

Whether the catalog defines function `name`.

# `function_description`
*since 0.1.0* 

```elixir
@spec function_description(t(), String.t()) :: String.t() | nil
```

A function's description, or `nil`.

# `function_properties`
*since 0.1.0* 

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

A function's parameters in positional order.

# `function_property_schema`
*since 0.1.0* 

```elixir
@spec function_property_schema(t(), String.t(), String.t()) :: term()
```

The schema of a function parameter, or `nil`.

# `function_required`
*since 0.1.0* 

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

The parameters a function requires.

# `new`
*since 0.1.0* 

```elixir
@spec new(A2UICore.Catalog.t(), String.t()) :: t()
```

The helper for one catalog, built for protocol `version`.

# `option_objects?`
*since 0.1.0* 

```elixir
@spec option_objects?(term()) :: boolean()
```

Whether a property holds a list of option objects (items with `label`
and `value` properties), so that plain strings are written as options.

# `property_enum`
*since 0.1.0* 

```elixir
@spec property_enum(t(), String.t(), String.t()) :: list() | nil
```

The values a component property's schema enumerates, or `nil`.

# `property_schema`
*since 0.1.0* 

```elixir
@spec property_schema(t(), String.t(), String.t()) :: term()
```

The schema of a component property, or `nil`.

# `reserved_keys`
*since 0.1.0* 

```elixir
@spec reserved_keys(String.t()) :: %{path: String.t(), call: String.t()}
```

The keys that mark a data binding and a function call in `version`:
`@path` and `@call` from v1.0, `path` and `call` before.

# `subschema`
*since 0.1.0* 

```elixir
@spec subschema(t(), term(), String.t()) :: term()
```

The schema at `key` below `schema`: the item schema for `"items"`,
else the schema of property `key` (or of any additional property),
found through `$ref`, `allOf`, `oneOf` and `anyOf`. `nil` when the
schema declares none.

---

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