Skip to content

feat: add optional comment field to ContentSheetCell - #17

Merged
Mearman merged 1 commit into
mainfrom
feat/cell-comment-schema
Aug 17, 2026
Merged

feat: add optional comment field to ContentSheetCell#17
Mearman merged 1 commit into
mainfrom
feat/cell-comment-schema

Conversation

@Mearman

@Mearman Mearman commented Aug 17, 2026

Copy link
Copy Markdown
Member

Cells had no way to carry an annotation, so anything reading a spreadsheet with comments had nowhere to put them and silently dropped them on the floor. This adds an optional comment field to ContentSheetCellSchema, one structured shape covering both mechanisms a real spreadsheet uses:

  • a legacy note (xlsx xl/comments*.xml, ODF annotations): { text, author?, createdAt? } with replies absent
  • a threaded comment (xlsx xl/threadedComments/*.xml): the same root shape plus a flat replies array of { text, author? } -- a reply never carries replies of its own, matching how threaded comments actually nest in the source formats

No union or kind discriminant is needed: a legacy note is simply a comment whose replies stay absent.

createdAt is an ISO 8601 date-time in the source format's own spelling and precision, present only when the source recorded one. Following the house precedent for temporal strings (ContentCellValueSchema's own wire-spelling contract), it is a stated contract rather than a validated format -- a regex would turn a producer not yet normalised to ISO 8601 into a hard parse failure.

The field is optional, existing documents validate unchanged, and CONTENT_FORMAT_VERSION stays 3 (a compatible addition, not a bump). content-json-schema-defs.ts needs no change -- it hand-transcribes only schemas behind the three z.custom() nodes, and ContentSheetCellSchema is a real z.object(), so the published content-document.schema.json picks the new field up automatically (verified in the generated output).

Unblocks ExaDev/ooxml.js#53 (xlsx comment reading needs this field to land in).

Generated by Claude Code

One structured shape covers both comment mechanisms a real spreadsheet
uses: xlsx's legacy single notes (text/author/createdAt, replies absent)
and its newer threaded comments (root text plus a flat replies array --
a reply never carries replies of its own). A legacy note is simply a
comment whose replies stay absent, so no union or discriminant is
needed. The field is optional on ContentSheetCellSchema, existing
documents validate unchanged, and CONTENT_FORMAT_VERSION stays 3.
@Mearman
Mearman merged commit b2160f6 into main Aug 17, 2026
11 checks passed
@Mearman
Mearman deleted the feat/cell-comment-schema branch August 17, 2026 13:35
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant