Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

anyone knows how to render List data using Barber(0.3.3)? #115

Closed
dlutweibo opened this issue Mar 29, 2022 · 2 comments
Closed

anyone knows how to render List data using Barber(0.3.3)? #115

dlutweibo opened this issue Mar 29, 2022 · 2 comments

Comments

@dlutweibo
Copy link

dlutweibo commented Mar 29, 2022

like mustache demo:

Template:
{{#items}}
{{#first}}
<li><strong>{{name}}</strong></li>
{{/first}}
{{#link}}
<li><a href="{{url}}">{{name}}</a></li>
{{/link}}
{{/items}}

Input:
{
"items": [
{"name": "red", "first": true, "url": "#Red"},
{"name": "green", "link": true, "url": "#Green"},
{"name": "blue", "link": true, "url": "#Blue"}
]
}

output:
<li><strong>red</strong></li>
<li><a href="#Green">green</a></li>
<li><a href="#Blue">blue</a></li>

I used Set type, but there was a execption, like:
"Failure to generate signature because of [memberProperty=properties] which must be a data class [returnType=kotlin.collections.Set<com.microsoft.thrifty.ogen.IDLModelHeaderProperty>]"

@adrw
Copy link
Collaborator

adrw commented Mar 31, 2022

Thanks for reporting, we don't have rigorous testing, use, or support of DocumentData schema's using non-String types. Barber has some initial support built in for supporting other Proto primitives like Instant and Duration but we haven't extended past that to other types like lists.

Though Barber uses Mustache under the hood, the Barber API and pattern exposed is a small, safer (ie. guardrails) subset of the power of Mustache.

@dlutweibo
Copy link
Author

Thank you for the information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants