After
ac4b1db Closure Templates issues a warning about using protobuf messages as the input
SoyRecord to a template.
We have many templates that defined their input params using soy types but passed SoyRecords to them using a protobuf message because it's easier to set its values.
I'm confused about how to modify our templates for future compatibility.
It looks like this following approach is now deprecated:
{template .test}
{@param number: int}
{@param aFlag: bool}
{@param textList: list<string>}
{/template}
Then define a protobuf message to build up the input params for SoyTofu:
message TestSoyRecord {
int32 number = 1;
bool a_flag = 2;
repeated text = 3;
}
This way the template's inputs are explicitly listed but it's also easy to assemble the input SoyRecord with a strongly-typed interface:
tofu.newRenderer(...).setData(SoyProtoValueImpl.create(
TestSoyRecord.newBuilder().setNumber(4).addText("xyz").setAFlag(true).build()
))
Is this approach now deprecated?