Skip to main content

resolve_custom_fields

Function resolve_custom_fields 

Source
pub fn resolve_custom_fields(
    scalars: &BTreeMap<String, Value>,
    sections: &[CustomFieldSection],
    editmeta: &EditMeta,
) -> Result<BTreeMap<String, Value>>
Expand description

Resolves a mixed set of frontmatter scalars and body sections into an API-ready custom field map keyed by stable field ID.

  • Scalars are dispatched by schema: option/radiobutton fields become {"value": "..."}, textfield/number/date pass through, rich-text fields are rejected (must use a body section instead).
  • Sections must reference rich-text fields; their markdown is converted to ADF via markdown_to_adf.

Field names are looked up in EditMeta; entries already formatted as customfield_<digits> bypass the lookup. An unknown or ambiguous name produces an error naming the available editable fields.