Skip to content

[Bug] "Optional" rendering of variables seems broken #40

@martinhalford

Description

@martinhalford

Based on previous versions of TemplateMark rendering into AgreementMark, we used to be able to render optional variables depending on if the optional data existed, or not.

EG 1:

In this example, the scalar attribute age is optional.

@template
concept TemplateData {
    o String name
    o Address address
    o Integer age optional
    o MonetaryAmount salary
    o String[] favoriteColors
    o Order order

We used to be able to use the following syntax in TemplateMark:

- {{#optional age}} You are *{{this}}* years old{{/optional}}

This now renders as:

" - You are "

We were expecting:

" - You are 42 years old" --or-- nothing, if age is undefined.

Screenshot:
Image

EG 2:

In this example, the object attribute signature is optional.

concept Party {
  o String partyId
  o String fullName
  o String email
  o String mobile
  o Address address
  o Signature signature optional
}

concept Signature {
  o String walletAddress
  o DateTime signedAt
}

We used to be able to use the following syntax in TemplateMark:

- **{{fullName}}**{{#optional signature}} (Signed: {{signedAt}}, Wallet: {{walletAddress}}){{/optional}}

This now renders as:

" - Fred Bloggs (Signed: "

We were expecting:

" - Fred Bloggs (Signed: 2024-01-15T15:45:00.000Z, Wallet: 0xabcdef1234567890abcdef1234567890abcdef12"

Screenshot:

Image

Summary

Is this a bug or are we using old syntax which is no longer supported?

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