Skip to main content

iso20022_from_frontmatter

Function iso20022_from_frontmatter 

Source
pub fn iso20022_from_frontmatter(
    value: &Value,
) -> Result<Iso20022Entity, DispatchError>
Expand description

Parses the iso20022: frontmatter block into a typed entity.

Returns Err(DispatchError) if the discriminant is missing or unknown — caller decides whether to warn or fail.

§Errors

Returns DispatchError::MissingType when no type discriminant is present, DispatchError::UnknownType when the discriminant is unrecognised, or DispatchError::Malformed when the payload fails to deserialise.

§Examples

use ssg::seo::jsonld::iso20022::from_frontmatter;
let fm = serde_json::json!({
    "type": "BankAccount",
    "iban": "GB29NWBK60161331926819",
});
let entity = from_frontmatter(&fm).unwrap();
assert_eq!(entity.type_name(), "BankAccount");