Skip to content

feat(EN10168): generate the v0.5.0 qr-code symbol at render time (#346) - #347

Merged
stiebitzhofer merged 3 commits into
mainfrom
feat/en10168-qr-code-346
Oct 6, 2026
Merged

stiebitzhofer merged 3 commits into
mainfrom
feat/en10168-qr-code-346

Conversation

@stiebitzhofer

Copy link
Copy Markdown
Member

Closes #346. Mirror of material-identity/schema#447 (schema PR #448).

What

EN10168 v0.5.0 has carried qr-code in KeyValueObject.Type since #101/#107/#108 added url, phone, email and image (2ab1e35), but no FEP specified it and nothing generated a symbol: the stylesheet branch was the image branch with fixed sizing. The product's supplementary information (B-section) also never passed Type to KeyValue, so a url there printed as text and a qr-code as its raw value.

The rule now, in v0.5.0 in place (no schema change): the value is the text the symbol encodes (typically a URL) and the renderer generates the symbol. A value that is already a data: image URI keeps rendering as that image, so earlier certificates do not change.

How

  • QrSymbol — zxing core 3.5.3 (new dependency, Apache-2.0, no transitives), SVG path data, ISO/IEC 18004 four-module quiet zone, EC level M. The same encoder as schema's :shared, so both services print the same picture.
  • QrCodeValues runs before the XSLT in both SchemasServiceImpl.renderPdf and CommandLineApp (json2pdf): on a copy of the certificate it replaces every encodable qr-code value with the SVG data URI of its symbol. The stylesheet's existing fo:external-graphic branch draws it; the JSON attached to the PDF stays the certificate as issued.
  • Stylesheet schemas/EN10168/v0.5.0/stylesheet.xsl is byte-identical to schema's legacy copy again: the B-section passes Type to KeyValue (schema#370) and the branch comment states the semantics. Every existing B-supplementary fixture entry is string/number, so no other render changes (RenderTest parity: 150/150).
  • Fixture test/fixtures/EN10168/v0.5.0/valid_certificate_11.json (url + qr-code pair in B20/B21) with its reference PDF rendered by json2pdf.

Tests

  • QrSymbolTest (12): matrix and SVG-path round-trip decode, escaping, quiet zone, attribute-safe path, blank and oversized input refused without echoing it.
  • QrCodeValuesTest (5): substitution rules (URL → symbol; data: / other types / blank / missing untouched), entries found anywhere without mutating the input, FO gate (B20 links, B21 draws from an SVG data URI, URL printed once).
  • RenderTest renders the new fixture against its reference PDF and asserts the attached JSON equals the fixture as issued.
  • mvn test: 150 render + 17 new, all green. npm test (fixture validation): 1979 passed.
  • Inspected the rendered page: the symbol prints as vector drawing under the link (pdfimages -list shows no raster symbol).

🤖 Generated with Claude Code

Mirror of material-identity/schema#447. EN10168 v0.5.0 has carried `qr-code`
in KeyValueObject.Type since the url/phone/email/image types were added
(2ab1e35), but nothing generated a symbol: the stylesheet drew whatever image
the value held, and the product's supplementary information never passed Type
to KeyValue, so a url there printed as text and a qr-code as its raw value.

The rule now, in v0.5.0 in place (no schema change): the value is the text the
symbol encodes (typically a URL) and the renderer generates the symbol. A value
that is already a data: image URI keeps rendering as that image.

- QrSymbol (zxing core 3.5.3; SVG path data, ISO/IEC 18004 quiet zone, EC level
  M) is the same encoder as schema's :shared.
- QrCodeValues replaces every encodable qr-code value with the symbol's SVG data
  URI on a copy of the certificate before the XSLT runs, in both the service
  (SchemasServiceImpl.renderPdf) and json2pdf (CommandLineApp); the attached
  JSON stays the certificate as issued.
- The EN10168 v0.5.0 stylesheet is byte-identical to schema's legacy copy again:
  the B-section passes Type to KeyValue (schema#370) and the qr-code branch's
  comment states the semantics.
- Fixture valid_certificate_11 (url + qr-code pair in B20/B21) with its
  reference PDF; tests round-trip the symbol, pin the substitution rules and
  gate the generated FO. RenderTest's attachment check covers the as-issued JSON.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@socket-security

socket-security Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedmaven/​com.google.zxing/​core@​3.5.37810090100100

View full report

stiebitzhofer and others added 2 commits October 6, 2026 11:55
…ry until 1.2.2 clears the release-age window

The weekly Grype DB of 2026-10-06 flags two packages in ui/package-lock.json
on every branch, main included:

- postcss-selector-parser 6.1.4 (GHSA-rj75-hqrm-r3gf, Medium): quadratic
  selector parsing. Pinned to 7.1.6 via npm overrides; tailwindcss 3.4.3 and
  postcss-nested asked for ^6 but build identically against 7.1.6 — the Angular
  build output is byte-identical before and after.
- source-map-js 1.2.1 (GHSA-68fv-2mgg-jv7q, High): event-loop DoS on untrusted
  source maps. The fix, 1.2.2, was published 2026-09-30 and the repo's .npmrc
  (min-release-age=7) quarantines it until 2026-10-07. Reached only through
  postcss/sass inside the Angular CLI build, never deployed; accepted in
  .grype.yaml until the window clears, bump tracked in #348.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@eamon0989
eamon0989 temporarily deployed to s1-schemas-pr-347 October 6, 2026 13:56 Inactive
@stiebitzhofer
stiebitzhofer merged commit 10f0f98 into main Oct 6, 2026
12 checks passed
@stiebitzhofer
stiebitzhofer deleted the feat/en10168-qr-code-346 branch October 6, 2026 20:49

This branch was previously deployed

1 inactive deployment
s1-schemas-pr-347 — 27249b7b Deployed Oct 6, 2026 by eamon0989
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

Successfully merging this pull request may close these issues.

feat(EN10168): generate the v0.5.0 qr-code symbol at render time

2 participants