Skip to content

fix: preserve allOf property constraints with additionalProperties false - #890

Open
flcrom wants to merge 1 commit into
fastify:mainfrom
flcrom:fix/allof-additional-properties
Open

flcrom wants to merge 1 commit into
fastify:mainfrom
flcrom:fix/allof-additional-properties

Conversation

@flcrom

@flcrom flcrom commented Oct 5, 2026

Copy link
Copy Markdown

Fixes #684.

Temporarily leave root additionalProperties: false out of the allOf merge, then restore it on the merged schema. This keeps nested coercion and required checks active while still dropping undeclared output properties. Explicit true and schema-valued additionalProperties keep their existing behavior.

Adds regressions for nested array properties, referenced/root constraints, required fields, and additional-property schemas. The nested coercion case fails on main.

Full tests pass on Linux with Node 20, 22, 24 and 26: 589 runtime tests, 100% coverage and 15 TypeScript assertions. ESLint and production license checks pass. Extra recursive/reference, patternProperties and input-immutability checks pass. macOS/Windows and dependency review are left to upstream CI.

This branch has not been deployed

No deployments
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.

allOf Schema and additionalProperties result in unexpected result

1 participant