Skip to content

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

Merged
Tony133 merged 3 commits into
fastify:mainfrom
flcrom:fix/allof-additional-properties
Oct 19, 2026
Merged

Tony133 merged 3 commits into
fastify:mainfrom
flcrom:fix/allof-additional-properties

Conversation

@flcrom

@flcrom flcrom commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

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.

@Puppo Puppo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Tony133
Tony133 merged commit fcfd56f into fastify:main Oct 19, 2026
17 checks passed
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

3 participants