Skip to main content

convert_textarea_string_values

Function convert_textarea_string_values 

Source
pub fn convert_textarea_string_values(
    fields: &mut BTreeMap<String, Value>,
    editmeta: &EditMeta,
) -> Result<()>
Expand description

Applies JFM → ADF conversion in-place to string values targeting rich-text custom fields, per issue #866.

For each entry in fields:

  • If the key is not present in editmeta.fields, leave the value untouched (pass-through — the API will surface its own error).
  • If the resolved field is not a rich-text textarea, leave the value untouched.
  • If the value is a JSON object, leave it untouched (assumed to be a raw ADF document — backwards-compatible).
  • If the value is a JSON string, treat it as JFM markdown and convert. An empty string becomes null, which clears the field.
  • Any other value type (number/bool/array/null) is left untouched.

Designed for the MCP jira_write fields escape hatch: lets callers pass "customfield_19300": "- bullet\n- bullet" and get the right ADF on the wire without hand-crafting the document.