feat(invalid-where-values-behavior): make throw the default#11710
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
|
@naorpeled I wonder why the commit workflow is running also in the TypeORM repo (not just in your repo). Maybe it's a new feature in GitHub? In that case we might not need the full PR workflow. |
Not sure either honestly 🤔 |
sgarner
left a comment
There was a problem hiding this comment.
LGTM 👍
Noting we ought to have a "Migrating to TypeORM v1.0" doc which explains how to deal with this impactful change, for projects which are upgrading.
|
/describe |
|
PR Description updated to latest commit (3d6db1c)
|
1 similar comment
|
PR Description updated to latest commit (3d6db1c)
|
3d6db1c to
7937eb1
Compare
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 2a73db5
Previous suggestionsSuggestions up to commit fb2a41a
Suggestions up to commit 51504f2
Suggestions up to commit 23e905e
✅ Suggestions up to commit e18a9fd
Suggestions up to commit 7123a5c
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Pull request overview
This PR changes the default behavior for handling null and undefined values in WHERE conditions from "ignore" (silently skip) to "throw" (raise an error). This is a breaking change that makes TypeORM more explicit and helps prevent unintended bugs where null/undefined values could lead to unexpected query results.
- Changed default null/undefined handling from "ignore" to "throw" in query builders
- Updated all documentation to reflect the new default behavior
- Modified tests to validate error throwing instead of value ignoring
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/query-builder/QueryBuilder.ts |
Changed default fallback values from "ignore" to "throw" for both null and undefined handling |
src/query-builder/SelectQueryBuilder.ts |
Changed default fallback values from "ignore" to "throw" in three locations (setFindOptions for undefined, null, and relation null handling) |
src/data-source/BaseDataSourceOptions.ts |
Updated JSDoc comments to mark "throw" as default and removed "(default)" marker from "ignore" options |
docs/docs/data-source/2-data-source-options.md |
Updated documentation to show "throw" as default and adjusted example configuration |
docs/docs/data-source/5-null-and-undefined-handling.md |
Updated entire documentation structure to reflect "throw" as default, clarified error behavior, and updated section headers |
test/functional/null-undefined-handling/find-options.test.ts |
Updated test suite to validate error throwing behavior instead of ignoring behavior, wrapping queries in try-catch blocks and asserting TypeORMError is thrown |
test/functional/find-options/empty-properties/find-options-empty-properties.test.ts |
Added explicit invalidWhereValuesBehavior configuration to maintain "ignore" behavior for this specific test suite |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
f099ecc to
7123a5c
Compare
7123a5c to
e18a9fd
Compare
we do: |
|
Persistent review updated to latest commit 0913a31 |
|
Persistent review updated to latest commit 601dcdd |
|
Persistent review updated to latest commit 9ff1f8a |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Persistent review updated to latest commit 279e426 |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Persistent review updated to latest commit 26dc724 |
|
Persistent review updated to latest commit 08ce9d5 |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Persistent review updated to latest commit 2b1f20b |
|
Persistent review updated to latest commit 44a5182 |
|
Persistent review updated to latest commit cf8ce9a |
… nested relations
|
Persistent review updated to latest commit 08b5d0a |
…ere-values-to-be-throw
|
Persistent review updated to latest commit 615fe8e |
…ere-values-to-be-throw
|
|
Persistent review updated to latest commit d3dee94 |



User description
Description of change
Closes #11695
Pull-Request Checklist
masterbranchFixes #00000PR Type
Enhancement
Description
Change default behavior for null/undefined in where conditions to throw
Update QueryBuilder and SelectQueryBuilder to use throw as default
Update documentation to reflect new default behavior
Update tests to expect errors instead of ignoring values
Diagram Walkthrough
File Walkthrough
BaseDataSourceOptions.ts
Update documentation for new default behaviorsrc/data-source/BaseDataSourceOptions.ts
values
undefined values
2-data-source-options.md
Update data source options documentationdocs/docs/data-source/2-data-source-options.md
of 'ignore'
instead of 'ignore'
'throw'
5-null-and-undefined-handling.md
Update null/undefined handling documentationdocs/docs/data-source/5-null-and-undefined-handling.md
errors
ignoring
QueryBuilder.ts
Change default null/undefined handling to throwsrc/query-builder/QueryBuilder.ts
SelectQueryBuilder.ts
Change default null/undefined handling to throwsrc/query-builder/SelectQueryBuilder.ts
setFindOptions
setFindOptions
handling
find-options-empty-properties.ts
Configure test to use ignore behavior explicitlytest/functional/find-options/empty-properties/find-options-empty-properties.ts
invalidWhereValuesBehaviorconfiguration to testconnections
compatibility
find-options.ts
Update tests to expect throw behavior by defaulttest/functional/null-undefined-handling/find-options.ts
'throw'
TypeORMError exceptions
encountered' or 'Undefined value encountered'
properties, null relations, undefined relations