Skip to content

Releases: AlexJPotter/fluentvalidation-ts

v5.0.0

25 May 21:14
Compare
Choose a tag to compare

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

25 May 16:28
Compare
Choose a tag to compare

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 case undefined is considered a "null" value
  • { includeUndefined: false } - in this case undefined 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

23 May 21:20
Compare
Choose a tag to compare

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

11 May 17:30
Compare
Choose a tag to compare

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

05 Mar 16:50
Compare
Choose a tag to compare

✨ New type exports

This release adds the following type exports to the root of the package:

  • ValueValidationResult (closes #41)
  • RuleValidators, AsyncRuleValidators (as per #47)

v3.1.0

09 May 08:31
Compare
Choose a tag to compare

🐛 Bug fixes

This release includes an export for the ValidationErrors type in the root of the package, which resolves #40.

v3.0.0

03 May 11:19
Compare
Choose a tag to compare

🛠 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 to fluentvalidation due to limitations in tsup

⚠ 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

07 Oct 12:22
Compare
Choose a tag to compare

✨ 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

19 Aug 07:25
Compare
Choose a tag to compare

🐛 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

v2.2.2

17 Jun 10:38
Compare
Choose a tag to compare

🐛 Bug fixes

  • #18 - Cannot chain .mustAsync method

🔧 General maintenance

  • Updated NPM packages for root project and documentation website