#129 Don't silently strip unknown fields in content and user zod schemas#136
Merged
Merged
Conversation
pnicolli
requested changes
Jun 12, 2026
pnicolli
left a comment
Collaborator
There was a problem hiding this comment.
I gave this a little bit of extra thought and came up with a few changes I would make. Overall, this is very much needed, thanks!
pnicolli
approved these changes
Jun 12, 2026
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.
Problem
Change notes entered in the
@@editform never reached the version history.The edit route forwards the note correctly — the loss happens in
@plone/client:updateContentbuilds the PATCH body from the zod-parsedargs, and zod's default object mode silently strips every key the schema does
not declare.
changeNotewas not declared, so it was dropped before therequest was sent.
This affected more than the change note: any field not whitelisted in
createContentDataSchema/updateContentDataSchemawas discarded on save —including all fields of custom dexterity types. The user schemas had the same
issue for custom member properties.
Change
createContentDataSchema/updateContentDataSchema: added.passthrough()and declared
changeNote.createUserDataSchema/updateUserDataSchema: added.passthrough().Declared fields are still validated exactly as before (a mistyped declared
field still throws);
.passthrough()only stops unknown keys from beingstripped, leaving the backend as the authority on which fields exist.
Schemas for fixed-protocol payloads (copy/move, comments, workflow) are
deliberately unchanged, and
registry.tsalready usedz.record.Tests
src/validation/passthrough.test.ts: unit tests — unknown fields surviveparsing on content and user schemas, declared fields still validated.
src/restapi/content/update.test.ts: integration test asserting thechangeNotelands as the version comment in@history.Caution
The Volto Team has suspended its review of new pull requests from first-time contributors until the release of Plone 7, which is preliminarily scheduled for the second quarter of 2026.
Read details.
If your pull request closes an open issue, include the exact text below, immediately followed by the issue number. When your pull request gets merged, then that issue will close automatically.
Closes #129