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

Proposal: RenderTemplate2024 #9

Open
BigBlueHat opened this issue Apr 9, 2024 · 8 comments
Open

Proposal: RenderTemplate2024 #9

BigBlueHat opened this issue Apr 9, 2024 · 8 comments

Comments

@BigBlueHat
Copy link

BigBlueHat commented Apr 9, 2024

The following proposals aims at a single, template format focused render method--where the content/media type decision becomes secondary (and is expressed separately). The proposed template engine would be Mustache for it's deliberate minimalism (though certainly alternatives could be explored).

The primary aim is to map the credential into a text-based template format (Mustache). The output format itself becomes a secondary concern (for rendering), though perhaps a primary concern for display/use choices.

Below is a proposed expression with inline comments:

"renderMethod": [
  {
  // human facing display name for selection
  "name": "Landscape",
  // media query as defined in https://www.w3.org/TR/mediaqueries-4/
  "mediaQuery": "@media (orientation: landscape)",
  // simplified type which focuses on template language compatibility (vs. "output" type)
  "type": "RenderTemplate2024",
  // inline template field for use cases where remote retrieval of a render method is suboptimal
  "template": "",
  // URL for remotely hosted template
  "url": "https://example.com/iso7810-landscape.svg",
  // content/media type for (possible) conneg on the above URL
  // and certainly for display use
  "mediaType": "image/svg+xml",
  // used for resource integrity and/or validation of the inline `template`
  "digestMultibase": "..."
  },

  // VoiceXML for non-visual use / A11Y (perhaps)
  {
  "name": "Audio",
  "type": "RenderTemplate2024",
  "template": "<?xml version=“1.0” encoding="iso-8859-1"?><vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xml:lang="en-US">...</vxml>",
  "mediaType": "application/voicexml+xml"
  }
]

Feedback welcome!
🎩

namhoang1604 pushed a commit to uncefact/project-vckit that referenced this issue May 6, 2024
<!--
  For Work In Progress Pull Requests, please use the Draft PR feature,
see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for
further details.
  
  For a timely review/response, please avoid force-pushing additional
  commits if your PR already received reviews or comments.
  
Before submitting a Pull Request, please ensure you've done the
following:
- 📖 Read the [Contributing
Guide](https://github.com/uncefact/project-vckit/blob/main/CONTRIBUTING.md).
- 📖 Read the [Code of
Conduct](https://github.com/uncefact/project-vckit/blob/main/CODE_OF_CONDUCT.md).
  - 👷‍♀️ Create small PRs. In most cases, this will be possible.
  - ✅ Provide tests for your changes.
- 📝 Use descriptive commit messages following [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
- 📗 Update any related documentation and include any relevant
screenshots.
-->

## What type of PR is this? (check all applicable)

- [x] 🍕 Feature
- [ ] 🐛 Bug Fix
- [ ] 📝 Documentation Update
- [ ] 🎨 Style
- [ ] 🧑‍💻 Code Refactor
- [ ] 🔥 Performance Improvements
- [ ] ✅ Test
- [ ] 🤖 Build
- [ ] 🔁 CI
- [ ] 📦 Chore (Release)
- [ ] ⏩ Revert

## Description
Some reference links about the compute hash:
https://w3c-ccg.github.io/vc-render-method/#svgrenderingtemplate2023
w3c-ccg/vc-render-method#9
https://w3c-ccg.github.io/multibase/#tv-base58btc
https://www.ietf.org/archive/id/draft-multiformats-multibase-08.html
https://www.npmjs.com/package/multihashes

<!-- 
Please do not leave this blank 
This PR [adds/removes/fixes/replaces] the [feature/bug/etc]. 
-->
## Related Tickets & Documents
<!-- 
Please use this format link issue numbers: Fixes #123

https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->

## Mobile & Desktop Screenshots/Recordings

<!-- Visual changes require screenshots -->


## Added tests?

- [x] 👍 yes
- [ ] 🙅 no, because they aren't needed
- [ ] 🙋 no, because I need help

## Added to documentation?

- [ ] 📜 README.md
- [ ] 📓 [vc-kit doc site](https://uncefact.github.io/vckit/)
- [ ] 📕 storybook
- [x] 🙅 no documentation needed

## [optional] Are there any post-deployment tasks we need to perform?


<!-- note: PRs with deleted sections will be marked invalid -->
@msporny
Copy link
Contributor

msporny commented May 27, 2024

"url": "https://example.com/iso7810-landscape.svg",

Why not use id instead of url?

@msporny
Copy link
Contributor

msporny commented Jun 11, 2024

The VC API group discussed this on a call today and there was no opposition to the general direction. On the call was @jandrieu @wes-smith @PatStLouis @cxcheng @TallTed and @msporny.

@dmitrizagidulin
Copy link
Collaborator

Why not use id instead of url?

I think url would be clearer. (since it's not the ID of the renderMethod config block. it's merely the location of the hosted template file, which is a small component of the overall config).

@msporny
Copy link
Contributor

msporny commented Jun 11, 2024

I think url would be clearer. (since it's not the ID of the renderMethod config block. it's merely the location of the hosted template file, which is a small component of the overall config).

Yes, I can kinda see that argument. The challenge is that digestMultibase (in the example) applies to id, not url... and so the only way that could work is we do this:

  "url": {
    "id": "https://example.com/iso7810-landscape.svg",
    "digestMultibase": "...."

and then if we move digestMultibase in there, we need to move media type in there... hopefully that highlights the problem I'm concerned about? Maybe we move all of this inside template, which could be a string or object?

@dmitrizagidulin
Copy link
Collaborator

@msporny I see. Two thoughts, then.

  1. Why does the media type need to move in to the url? It belongs to the config, not to the url, no?

  2. In that case, how about we do, instead:

"renderMethod": [
  {
    "template": {
      // For hosted templates
      "id": "https://example.com/iso7810-landscape.svg",
      "digestMultibase": "...."
    },
    // ...
  },

  {
    "template": {
      // For inline templates
      "contents": "<template goes here>"
      // "digestMultibase": -- not needed, since the data integrity proof secures embedded templates
    },
    // ...
  }
]

@dlongley
Copy link

@dmitrizagidulin, @msporny, please take a look here at the modeling suggestions as perhaps some of this ground has been covered before:

#1

A combination of the information there and here might result in both a more correct and versatile data model.

@dlongley
Copy link

dlongley commented Jun 13, 2024

I think we need to do a slightly better job of separating the render method information from the template itself (or one or more templates potentially) -- and both the information and the template(s) may each potentially include a digest property, depending on whether they are embedded or simply referenced.

@msporny
Copy link
Contributor

msporny commented Jun 18, 2024

A general observation since we went to a "date-less" type for SvgRenderTemplate and then immediately broke backwards compatibility. I'm (unsurprisingly) increasingly of the opinion that we need to version these types as they go through incubation. I'm willing to say that once we go through a standardization process for the types that we can remove the date then, but not before as we keep breaking backwards compat during incubation (and people ARE shipping these broken things into production, no matter how much we plead with them to not to do that).

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

4 participants