Repository navigation
fix: use schema defaults for empty boolean and number values - #300
Merged
Merged
Conversation
toSchema() coerced an empty value as if it were set. An empty boolean value became false, and an empty number value became NaN. SqlClient reads an empty number value, such as `Connect Timeout=`, as not set, and uses the default. toSchema() now gives the schema default for an empty, or whitespace only, value of a boolean or number key. For example, with MSSQL_SCHEMA, `Connect Timeout=` now gives 15. The key stays in the result, with the value `undefined` if the schema has no default. An empty value of a string key does not change, so an empty password is still an empty string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dhensby
force-pushed
the
fix/empty-value-defaults
branch
from
November 18, 2026 21:23
eea22d6 to
2c49b2b
Compare
dhensby
marked this pull request as ready for review
November 18, 2026 21:49
|
🎉 This PR is included in version 1.1.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
An empty value for a boolean or number key, such as
Connect Timeout=, now gives the schema default intoSchema(). Before, an empty boolean value gavefalse, and an empty number value gaveNaN.Changes
toSchema()uses the schema default for an empty, or whitespace-only, boolean or number value. The key stays in the result, withundefinedif the schema has no default. An empty string value, such asPassword=, is still''.get()does not change.Behaviour changes
An empty value is not a valid connection string value, so these changes affect only malformed input:
Connect Timeout=now gives15, notNaN, andMax Pool Size=gives100.Pooling=now givestrue, andTrustServerCertificate={ }givesfalse.Encrypt=still givesfalse, the schema default.Encrypt={ }now also givesfalse; before, it gavetrue.A connection string that leaves a key out gives the same result as before.
Testing
npm run lint,npm run test:coverage,npm run buildandtsc --noEmitpass. All 68 tests pass on Node 20, 22 and 24.Part of #279.
🤖 Generated with Claude Code