Builds nested Spark.Options schemas from flat parameter definitions.
This module converts the flat [{path, opts}] format from
__bb_parameter_schema__/0 into nested keyword lists suitable for
validating start_link options.
Example
iex> flat = [
...> {[:motion, :max_speed], [type: :float, default: 1.0]},
...> {[:motion, :acceleration], [type: :float, default: 0.5]},
...> {[:debug_mode], [type: :boolean, default: false]}
...> ]
iex> BB.Parameter.Schema.build_nested_schema(flat)
[
debug_mode: [type: :boolean],
motion: [type: :keyword_list, keys: [
acceleration: [type: :float],
max_speed: [type: :float]
]]
]
Summary
Functions
Builds a nested Spark.Options schema from flat [{path, opts}] list.
Flattens nested keyword params to [{path, value}] format.
Functions
Builds a nested Spark.Options schema from flat [{path, opts}] list.
The resulting schema can be passed to Spark.Options.validate/2 to validate
nested keyword lists like [motion: [max_speed: 2.0]].
All parameters are optional (no :required flag) since we're validating
partial overrides. The :default key is removed from each parameter's opts
since defaults are handled separately by the DSL.
Flattens nested keyword params to [{path, value}] format.
This is the inverse of the nesting - it takes validated params like
[motion: [max_speed: 2.0]] and returns [{[:motion, :max_speed], 2.0}].