feat(render-method-2024)!: align RenderTemplate2024 with downstream renderer#19
Merged
Merged
Conversation
Update the `RenderTemplate2024` interface and provider so that constructed render methods conform to the W3C-CCG vc-render-method specification. Breaking changes: - `RenderTemplate2024.type` is now `string[]` (must contain `"RenderTemplate2024"`) rather than a single literal. - `RenderMethod2024.construct` no longer emits unset optional fields as empty strings; only fields with non-empty string values are included in the result. Additions: - New optional fields on `RenderTemplate2024`: `name`, `mediaType`, `digestMultibase`. All accepted via the `extra` argument. - `extractRenderTemplate` now resolves the render method type from either a string or string[] discriminator and throws `UnsupportedRenderMethodError` (with diagnostic detail for empty or unsupported arrays) when no supported entry is present. Closes #18
Contributor
This was referenced May 1, 2026
Closed
Merged
ashleythedeveloper
added a commit
that referenced
this pull request
May 1, 2026
* chore: fix extractRenderTemplate example format (#3) * feat: normalise template whitespace (#4) * feat: enhance removeLineBreaks to handle \r and consecutive line breaks (#5) * ci: update changelog config (#7) * ci: update changelog config (#9) * ci: fix changelog manifest version bump (#11) * ci: remove node workspace plugin (#15) * chore: add repository information * feat(render-method-2024)!: align RenderTemplate2024 with downstream renderer (#19) * chore: re-trigger release-please * chore: bump version to 2.0.0 and update changelog (#22)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR aligns the
RenderTemplate2024interface and provider with the shape already produced and consumed by the downstream vckit renderer (packages/renderer/src/providers/render-template-2024.ts), so render methods built viaconstructRenderMethodround-trip cleanly through the renderer with no missing fields.The renderer reads
name,mediaType, anddigestMultibase, and atypearray containing"RenderTemplate2024". The previous interface only modelledmediaQuery,template, andurl, and emitted unset optional fields as empty strings, neither of which match what the renderer expects.Closes #18
Breaking changes
RenderTemplate2024.typeis nowstring[]rather than the literalRenderMethodType.RenderTemplate2024. Direct consumers of the type (anyone readingrenderMethod.type === 'RenderTemplate2024') must update torenderMethod.type.includes('RenderTemplate2024').RenderMethod2024.constructno longer emits unset optional fields. Code that relies onmediaQuery: ''orurl: ''always being present must check for the property before reading it.Additions
RenderTemplate2024:name,mediaType,digestMultibase. All are accepted via theextraargument ofconstructRenderMethodand only emitted when supplied as non-empty strings.extractRenderTemplateresolves the discriminator from either string orstring[]typevalues, throwingUnsupportedRenderMethodError(with diagnostic detail for empty or unsupported arrays) when no supported entry is present.Out of scope (potential follow-ups)
typeto a tuple form ([RenderMethodType.RenderTemplate2024, ...string[]]) to encode the "must contain" invariant in the type system.RenderTemplate2024into Input vs Emitted variants to express the producer/consumer asymmetry.constructRenderMethod(currently only the extract path validates).Test plan
typeis emitted as an array containing"RenderTemplate2024"name,mediaType, anddigestMultibaseare accepted viaextraand round-tripped onto the constructed render methodundefined, missing, empty string, or non-string values are omitted from the constructed render method (no empty-string emission)templateis omitted when empty (URL-only construction)extractRenderTemplateresolves the render method type from astring[]discriminator, including arrays with additional entriesextractRenderTemplatepasses through a non-arraytypeunchanged forWebRenderingTemplate2022extractRenderTemplatethrowsUnsupportedRenderMethodErrorwith the joined unsupported entries, and with<empty>when the array is emptyyarn build,yarn test,yarn lint, andyarn formatall pass