BB.Dsl.ChildSpecOptions (bb v0.30.1)

Copy Markdown View Source

A child spec's options, resolved as far as compile time allows.

Used by the verifiers that need to ask a component module about itself before the robot exists - what options it accepts, what its driver can do - so they all take the same view of a param() reference.

Which is that they can't see one. A parameter isn't resolved until the robot is running and its store has been populated, so a parameterised option is dropped here and its key is not required, leaving the schema's default in its place. Anything reading these options has to answer for the default rather than for the value the robot will actually run with.

Summary

Functions

Split a child spec into its module and options.

Validate options against the module's options_schema/0, applying defaults.

Functions

module_and_options(module)

@spec module_and_options(module() | {module(), keyword()}) :: {module(), keyword()}

Split a child spec into its module and options.

validate(module, opts)

@spec validate(
  module(),
  keyword()
) :: {:ok, keyword()} | {:error, Spark.Options.ValidationError.t()}

Validate options against the module's options_schema/0, applying defaults.

Parameterised options are dropped and their keys made optional, so a spec that is only valid once its parameters resolve still validates here.