Riddler.Screens.Registry (Riddler v0.1.0)

Copy Markdown View Source

The node types this version of the runtime knows, by the name a document spells them with.

A document's type is an open string: the schema does not enumerate the types, so a host may carry a document holding a type through a validator older than that type without having it rejected on the way. This registry is the other half of that rule. It does enumerate them, so a type it does not know is refused here, loudly, naming the type and the node - never a node quietly passed through as though the runtime had understood it.

The v1 types are heading, text, text_question, button and variant.

iex> Riddler.Screens.Registry.types()
["button", "heading", "text", "text_question", "variant"]

iex> Riddler.Screens.Registry.fetch("heading")
{:ok, Riddler.Screens.Type.Heading}

iex> Riddler.Screens.Registry.fetch("carousel")
:error

Summary

Functions

The module implementing type, or :error when this version has no such type.

Every type name this version knows, sorted.

Functions

fetch(type)

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

The module implementing type, or :error when this version has no such type.

types()

@spec types() :: [String.t()]

Every type name this version knows, sorted.