FeaturevisorSchemas.OptionSource (featurevisor_schemas v2.1.0)

Copy Markdown View Source

Choices for a field that come from the application, such as cities from a service. search gets a query and returns {:ok, choices}, each a value or a map with a "value". lookup gets a value and returns {:ok, fields} for the choice it finds, :error for none, which reports enum, or {:error, reason} when it cannot tell, which reports refineError.

Summary

Types

t()

@type t() :: %FeaturevisorSchemas.OptionSource{
  key: String.t(),
  lookup:
    (term(), FeaturevisorSchemas.CheckInfo.t() ->
       {:ok, map()} | :error | {:error, term()})
    | nil,
  message: String.t() | nil,
  path: String.t(),
  reads: [String.t()],
  search:
    (String.t(), FeaturevisorSchemas.CheckInfo.t() ->
       {:ok, list()} | {:error, term()})
    | nil
}