Skip to content

feat!: migrate to document-schema.js 4.0.0 (ContentDocument drops formatVersion) - #61

Merged
Mearman merged 2 commits into
mainfrom
feat/schema-4-content
Aug 18, 2026
Merged

feat!: migrate to document-schema.js 4.0.0 (ContentDocument drops formatVersion)#61
Mearman merged 2 commits into
mainfrom
feat/schema-4-content

Conversation

@Mearman

@Mearman Mearman commented Aug 18, 2026

Copy link
Copy Markdown
Member

Part of the schema 4.0.0 family migration (ExaDev/document-schema.js#20).

document-schema.js 4.0.0 retired ContentDocument's per-arm formatVersion literal and the CONTENT_FORMAT_VERSION constant: ContentDocument is the in-process codec-exchange type, never a serialised artefact in its own right, so versioning now lives only at the serialised-artefact boundary via the release-pinned $schema URI. This PR migrates odf.js to ^4.0.0 in the same mechanical shape as the other codecs:

  • stop stamping formatVersion at every ContentDocument construction: the ods embedded-object dispatch's four kind arms (readEmbeddedObjectDocument in src/typed/ods/read.ts) and readOdfFormulaDocument in src/typed/formula/read.ts
  • drop the retired CONTENT_FORMAT_VERSION imports
  • update the formula reader test that asserted the stamp
  • odf.js imports nothing from the removed Layout* family (only LayoutMetadata, which stays in the schema)

While in the readers, three stale scope claims recorded by this repo's fidelity inventory (#59) are corrected, comment-only with no behaviour change: fields are dropped entirely (run collection has no field branch, so even the cached text is unread), cell borders ARE resolved by readCellStyleDecoration (src/typed/shared/table.ts), and draw:control geometry is dropped today (readBlocks has no draw:control branch and the ods shape walker skips it explicitly).

BREAKING: ContentDocuments produced by odf.js no longer carry formatVersion, and the package requires document-schema.js ^4.0.0 → major release.

Generated by Claude Code

document-schema.js 4.0.0 retired ContentDocument's per-arm formatVersion
literal and the CONTENT_FORMAT_VERSION constant: ContentDocument is the
in-process codec-exchange type, never a serialised artefact in its own
right, so versioning now lives only at the serialised-artefact boundary
via the release-pinned $schema URI. Drop the constant's imports and stop
setting the field at every construction site: the ods embedded-object
dispatch's four kind arms (readEmbeddedObjectDocument) and the formula
reader (readOdfFormulaDocument). The formula reader test asserting the
stamp goes with it.

BREAKING CHANGE: every ContentDocument odf.js produces now omits
formatVersion, and the package requires document-schema.js ^4.0.0.
Three comments described reader behaviour that does not exist:

- odt/read.ts's SCOPE note scoped out "fields beyond their
  cached/last-computed text value", implying the cached text is read --
  run collection has no field branch at all (readOdfParagraph drops a
  field child without even its cached text), so fields go unread
  entirely.
- The same note listed cell borders as out of scope, but
  readCellStyleDecoration (typed/shared/table.ts) has resolved borders
  through the table-cell style chain since it landed.
- odb/form.ts claimed the drawing layer's draw:control geometry "is
  read by readOdt as ordinary document content" -- readBlocks has no
  draw:control branch and the ods shape walker skips the element
  explicitly, so control geometry is dropped today.

Comment-only changes, no behaviour.
@Mearman
Mearman merged commit 7b9ca6d into main Aug 18, 2026
10 checks passed
@Mearman
Mearman deleted the feat/schema-4-content branch August 18, 2026 10:52
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 4.0.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