-
Notifications
You must be signed in to change notification settings - Fork 5
Introduce RenderMethod for untemplated renderings.
#38
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
base: main
Are you sure you want to change the base?
Conversation
This is especially useful when folding/collapsing sections in an editor that supports that.
This also introduces the concept of `modality` which may be useful for other types of render methods.
RenderMethod for untemplated renderings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BigBlueHat cc: @dlongley
LGTM at first read.
Additionally, I feel we still need to update nfc example 8 in here https://pr-preview.s3.amazonaws.com/w3c/vc-render-method/pull/38.html#example-usage-of-the-nfc-render-suite - replace payload with template as field name.
Payload name is only for legacy support and should not be used for any new NFC development work. Template field name should be used IIRC from the slack conversation between you, me and Dave Longley.
index.html
Outdated
| <h4>RenderMethod</h4> | ||
|
|
||
| <p> | ||
| In situations where templating is not required, an [=issuer=] can provide a | ||
| predetermined payload to be displayed, transmitted, or otherwise rendered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should use what could be the base class for all render methods for this -- specifically because of the payload property, which I'll explain more on below. If we want to do this, we ought to use another name. Maybe PayloadRenderMethod or StaticRenderMethod?
I think it does make sense to define a base class (probably named RenderMethod) for all render methods, but it should only include those properties that are expected to be available/used (and not in conflict) with any derived classes. If we include payload as a property on the base class, it will be in conflict with TemplateRenderMethod which not only does not use it, but uses something else for a similar purpose: template.
Notably, the value of template could already potentially be used to produce a "static" output, which would cover the payload case without the need for yet another render method. We should discuss and decide whether it's worth having a render method just for a single special case of templating.
Presumably, there's some performance benefit to not running a template through a template engine when this is the case. However, I expect that to probably be a fairly minor benefit -- especially when weighed against the aggregate cost of every rendering application in the ecosystem needing to implement a different bit of code for a special case (and the testing, test suite, etc., required).
Also, TemplateRenderMethod may still produce a "static" output anyway even after this. Certainly, IMO, creating an error case and trying to detect whether a template "changed" in its output (and should have been SomethingElseRenderMethod on that basis) is not a good use of effort or resources.
I think many of the properties below make sense to go into a base class: description, name, id, type, modality, etc. I also wonder whether renderProperty should be in the base class. The renderProperty is a declaration by the issuer of what information from the VC will be present in the rendering. This has utility for rendering software regardless of whether the output of filtering a VC (via this property) is used in the output directly or just implicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way to do "static" rendering is to use TemplateRenderMethod and specify the template engine as static (as opposed to mustache or whatever else), and specify the template with an appropriate media type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably, there's some performance benefit to not running a template through a template engine when this is the case.
I think there's also a security consideration here as authors may want to avoid the contents being passed to other processors, and so are providing something with no additional processing expectations.
I agree that RenderMethod can (and probably should be a base class that TemplateRenderMethod extends with templating functionality) and ideally the additional "content" term (i.e. payload or template or whatever) is inherited as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also,
TemplateRenderMethodmay still produce a "static" output anyway even after this. Certainly, IMO, creating an error case and trying to detect whether a template "changed" in its output (and should have beenSomethingElseRenderMethodon that basis) is not a good use of effort or resources.
Not suggesting that at all, just that the author of the credential should have a way to express that they do not want this processed only displayed which the overloading of the template term would not allow--without additional signals as you mention with static as a template engine option.
Either way, authors of credentials should be empowered to provide inert values for display/use (as with the nfc use case).
Useful for signaling what is to be shared via the render method.
The goal is to have a single term for both static and pre-processed content provided in the render method.
I agree, I think the field containing the template should be termed |
dmitrizagidulin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. (payload field should be renamed to template if at all possible, though.)
| <td> | ||
| A REQUIRED [=string=] that identifies the algorithms that are used for | ||
| generating the concrete rendering. | ||
| A REQUIRED [=string=] that identifies the mode by which the payload will be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might make more sense to make this field OPTIONAL. (or, if missing, default to the value default or something similar)
| </section> | ||
|
|
||
| <section> | ||
| <section><!-- pdf-mustache Render Suite --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should remove the pdf-mustache section. PDF is a binary format, it's not really possible to use Mustache with it.
|
Discussed during Wed Dec 3, 2025 call.
Consensus so far:
Lets refactor this PR and re-discuss. |
| A REQUIRED [=string=] that identifies the algorithms that are used for | ||
| generating the concrete rendering. | ||
| A REQUIRED [=string=] that identifies the mode by which the payload will be | ||
| transmitted or rendered. Possible examples of modalities may include `nfc`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible, examples, and may are redundant.
| transmitted or rendered. Possible examples of modalities may include `nfc`, | |
| transmitted or rendered. Possible modalities include `nfc`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or
| transmitted or rendered. Possible examples of modalities may include `nfc`, | |
| transmitted or rendered. Example modalities include `nfc`, |
|
|
||
| <pre class="example nohighlight" | ||
| title="Usage of the render property by an issuer"> | ||
| title="Usage of the nfc render suite"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| title="Usage of the nfc render suite"> | |
| title="Use of the NFC render suite"> |
| </table> | ||
|
|
||
| <pre class="example nohighlight" | ||
| title="Usage of the renderSuite property by an issuer"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| title="Usage of the renderSuite property by an issuer"> | |
| title="Use of the renderSuite property by an issuer"> |
RenderMethodsection; movenfcthere.This is an attempt to address #37 and uses ideas from #32 which could be expanded to the other render method definitions.
Preview | Diff