accordproject / template-playground

Web Playground for TemplateMark templates
https://playground.accordproject.org
Apache License 2.0
17 stars 19 forks source link

TemplateMark not rendering complex data types #14

Open martinhalford opened 1 year ago

martinhalford commented 1 year ago

Context

Consider the template "Late Delivery and Penalty".

The model contains the definition:

import org.accordproject.time@0.3.0.{Month, Day, TemporalUnit, Duration, PeriodUnit, Period} from https://models.accordproject.org/time@0.3.0.cto

@template
asset LateDeliveryAndPenaltyContract extends Contract {
  ...etc...
  o Duration penaltyDuration
  ...etc...
}

The data.json reads as follows:

{
    "$class": "org.accordproject.latedeliveryandpenalty@0.18.0.LateDeliveryAndPenaltyContract",
     ...etc...
    "penaltyDuration": {
        "$class": "org.accordproject.time@0.3.0.Duration",
        "amount": 2,
        "unit": "days"
    },
     ...etc...
}

The grammar is defined as:

## Late Delivery and Penalty.

.... for every {{penaltyDuration}}

Expected Behavior

As per olde Template Studio, the text used to renders as:

Late Delivery and Penalty.
----

... for every 2 days

Actual Behavior

The Template Playground renders the same model, grammar and data as:

## Late Delivery and Penalty.

... for every {"$class":"org.accordproject.time@0.3.0.Duration","amount":2,"unit":"days"} 
jatinder14 commented 6 months ago

@mttrbrts I am here for gsoc24 I want to contribute to this project https://playground.accordproject.org/ would you be able to guide me from where I should start I will be highly thankful to you

Sulochan-khadka commented 6 months ago

@martinhalford If possible, kindly mention the steps to reproduce. As it seems a standard procedure while writing down an issue and it helps me a lot while solving the issues.