Skip to content

draft() emits ciceromark Formula node without required "value" field for inline {{% expr %}} formulas #146

Description

@mttrbrts

Reproduction

Repo: accordproject/cicero-template-library PR #484, template src/supply-agreement-loc.

grammar.tem.md (excerpt):

An initial payment of {{% importerLOCAmount / 2.0 %}} will be made immediately upon sight ...

model.cto:

@template
asset TemplateModel extends Clause {
  o Double importerLOCAmount
  ...
}

Driver:

const t = await Template.fromDirectory('./src/supply-agreement-loc');
await new TemplateArchiveProcessor(t).draft(data, 'markdown', {});

Observed

Error: Generated invalid agreement: ValidationException: The instance "org.accordproject.ciceromark@0.6.0.Formula" is missing the required field "value".: {
  "$class": "org.accordproject.commonmark@0.5.0.Document",
  ...
}

The engine produces a ciceromark@0.6.0.Formula node and then validates the output; the produced node is missing the required value field, so validation fails. The formula has nothing fancy — a single division of a model field by a constant.

Expected

draft() evaluates the inline formula, sets the resulting string on Formula.value, and produces a valid AgreementMark document.

Versions

  • @accordproject/template-engine@3.0.1
  • @accordproject/cicero-core@0.26.0
  • @accordproject/concerto-core@4.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions