Skip to main content

field_table_for_path

Function field_table_for_path 

Source
pub fn field_table_for_path(
    root: &Value,
    path: &str,
    include_enabled: bool,
    defaults: Option<&Value>,
) -> Result<String, String>
Expand description

Navigate the full Config schema (schema_for!(Config)) to the section at path (dotted, e.g. channels.matrix, providers.models, acp) and render that section’s fields via field_table. Map nodes (Rust HashMap<String, T>, rendered by schemars with additionalProperties) are transparently descended into their value type, and an <alias> placeholder is inserted into the displayed config prefix at each crossing so the per-field deep-links and config set commands carry the right path (channels.matrix -> channels.matrix.<alias>).

Returns an error string (as a visible HTML comment) when the path does not resolve, so a typo in a directive fails loudly in the rendered page rather than silently emitting nothing. Navigate the full Config schema (schema_for!(Config)) to the section at path (dotted, e.g. channels.matrix, providers.models, acp) and render that section’s fields via field_table. Map nodes (Rust HashMap<String, T>, rendered by schemars with additionalProperties) are transparently descended into their value type, and an <alias> placeholder is inserted into the displayed config prefix at each crossing so the per-field deep-links and config set commands carry the right path (channels.matrix -> channels.matrix.<alias>).

defaults is the serialized Default::default() of the section struct that path resolves to (for a map section, the map’s value type). It lets a field’s real default (false, [], {}, null) surface even when schemars omits the schema default key for skip_serializing_if fields. Pass None to fall back to schema-only defaults.

Returns an error string when the path does not resolve, so a typo in a directive fails loudly in the rendered page rather than silently emitting nothing.