Releases: AlexJPotter/fluentvalidation-ts
v5.0.0
v5.0.0 is a major release as it contains breaking changes that have been introduced to address issues #43 and #45 - read on for more information!
Breaking changes 💣
scalePrecision
has changed to precisionScale
✏️
This change resolves #43.
The implementation of the (now removed) scalePrecision
rule was incorrect, with the precision
and scale
parameters being mixed up. The new precisionScale
method addresses this error and brings fluentvalidation-ts in line with both the naming used by FluentValidation and the ordering of arguments as they appear in SQL (see this issue for further information).
Caution
When switching from scalePrecision
to precisionScale
you will need to reverse the order of the arguments. For example, scalePrecision(2, 4)
will need to become precisionScale(4, 2)
. Do not be fooled by the erroneous naming of arguments in the previous method!
Check out the shiny new documentation page for .precisionScale for all the details.
Behaviour change for multiple when
and/or unless
calls in the same chain ⛓️💥
This change resolves #45.
Previously, a call to .when
or .unless
with the 'AppliesToAllValidators'
option would add a condition to all rules in the current rule chain, regardless of the presence of other calls to .when
and/or .unless
. This behaviour was inconsistent with FluentValidation and made it necessary to define multiple rules chains to achieve the desired behaviour.
With this change, calling .when
or .unless
with the 'AppliesToAllValidators'
option will add the specified condition to all rules in the current rule chain that follow the most recent call to .when
or .unless
.
Check out the updated documentation pages for a more detailed explanation and some examples:
Found a bug? 🐛
As always, if you spot any issues, please report them by raising an issue on GitHub.
v4.1.0
New Features ✨
Improvements to .notNull
and .null
Up to now, the .notNull
and .null
rules implicitly included undefined
in the definition of "null" - this behaviour was chosen for simplicity, but doesn't allow for "strict" (triple-equals) null-checks in cases where null
vs undefined
semantics are important.
Both rules now accept an optional ruleOptions
object - this is comprised of a single includeUndefined
property that controls whether or not to include undefined
in the definition of "null".
{ includeUndefined: true }
- in this caseundefined
is considered a "null" value{ includeUndefined: false }
- in this caseundefined
is not considered a "null" value.
If not provided, the ruleOptions
object defaults to { includeUndefined: true }
- this decision has been taken to maintain backwards compatibility.
See the following documentation pages for more information:
[NEW] Introducing .notUndefined
and .undefined
Given the above change, it seemed only logical to introduce complementary .notUndefined
and .undefined
rules to provide a complete set of rules for dealing with nullable and optional properties.
Both rules should be fairly self-explanatory - please refer to the documentation for more information:
Issues
This release addresses the null
vs undefined
semantic restriction as raised in #30.
v4.0.0
Internal type overhaul and general tidying up 🧹✨
This release sees a fairly significant overhaul of the internal types, which had become somewhat cumbersome and hard to work with. Situations in which the type system had to be forcibly subverted have been addressed, and several helper types have been extracted to simplify some of the more complex conditional type logic.
This release should not contain any breaking changes (all functional and type-level tests are passing), but with refactors this significant there's always a slim risk that something will break for someone, so I've made this a major release just to be safe.
If you do encounter any issues, please raise an issue and I'll take a look when I can.
v3.3.0
Maintenance 🔧
- Update packages
- Switch from Yarn to vanilla NPM
- Fully remove TSDX
- Switch from TSLint to ESLint
This release should not contain any breaking changes, but please raise an issue if you spot something that isn't quite right!
v3.2.0
v3.1.0
v3.0.0
🛠 Changes
- Switch from using TSDX to using tsup for bundling, due to TSDX no longer being maintained and it causing Content Security Policy (CSP) violations in certain situations
💥Breaking changes
- Output files have been renamed, so if you are including the package via a CDN, you will need to update your script tag to point at
/dist/index.global.js
- The global variable added when you include the package via a CDN has been renamed from
fluentvalidation-ts
tofluentvalidation
due to limitations intsup
⚠ Notes
- The library should work exactly as before, but there's always a chance that the move to a new bundler will have some unexpected consequences - please raise an issue if you notice any regression in functionality
v2.3.0
✨ New features
This release adds support for specifying validation rules on transformed values, as per the proposal outlined in Issue #11.
For more information, see the documentation pages here:
🐛 Issues
This release includes some fairly substantial changes to how the code works under-the-hood. If you spot any problems, please raise an issue on the repo.
v.2.2.3
🐛 Bug fixes
- Fixed issue whereby numbers with large fractional parts were not displayed correctly in error messages
🔧 General maintenance
- Added Prettier rule for line breaks