-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve documentation readme about migration #146
base: refactor_2024_11
Are you sure you want to change the base?
Improve documentation readme about migration #146
Conversation
@deandreamatias I created this PR to do the item 2 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## refactor_2024_11 #146 +/- ##
=================================================
Coverage 98.74% 98.74%
=================================================
Files 111 111
Lines 1510 1510
=================================================
Hits 1491 1491
Misses 19 19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I am writing the migration guide now. Datetime validators
File validators
Finance validators
Miscellaneous validators
Network validators
Numeric validators
String validators
User Information validators
|
I will take a look and check. When ready, will write a comment |
Added the first migration instructions below. Please, check if they are very clear. Otherwise, I refactor them for them to be clearer. ### v11 to v12
- Deprecate `FormBuilderValidators` class with its static methods as validators.
- Instead, you should use `Validators` class.
- Instructions on how to update each old API validator to the new API equivalent:
- **checkNullOrEmpty**: Before specifying the equivalent to each validator, it is important to deal with the `checkNullOrEmpty` parameter. Every validator from the old API has this parameters, thus we are going to use this section to specify how to handle this situation for most of the cases and we will assume that this aspect is already handled for the following sections:
- `checkNullOrEmpty = true`: Given the old api: `FormBuilderValidators.someValidator(..., checkNullOrEmpty:true)`, the equivalent in the new API is `Validators.required(Validators.someEquivalentValidator(...))`.
- `checkNullOrEmpty = false`: Given the old api: `FormBuilderValidators.someValidator(..., checkNullOrEmpty:false)`, the equivalent in the new API is `Validators.optional(Validators.someEquivalentValidator(...))`.
- Bool validators
- For this group of validators, it is expected to receive a `String` as user input. Thus, if your
form widget does not guarantee a `String` input (it may receive an `Object`), you must wrap the
equivalent validator with the type validator for strings. Thus, instead of
`Validators.hasMin<Something>Chars(...)`, use `Validators.string(Validators.hasMin<Something>Chars(...))`
- `FormBuilderValidators.hasLowercaseChars(atLeast: n, regex: reg, errorText: 'some error')` is
equivalent to `Validators.hasMinLowercaseChars(min: n, customLowercaseCounter:(input)=>reg.allMatches(input).length, hasMinLowercaseCharsMsg:(_, __)=>'some error')`
- `FormBuilderValidators.hasNumericChars(atLeast: n, regex: reg, errorText: 'some error')` is
equivalent to `Validators.hasMinNumericChars(min: n, customNumericCounter:(input)=>reg.allMatches(input).length, hasMinNumericCharsMsg:(_, __)=>'some error')`
- `FormBuilderValidators.hasSpecialChars(atLeast: n, regex: reg, errorText: 'some error')` is
equivalent to `Validators.hasMinSpecialChars(min: n, customSpecialCounter:(input)=>reg.allMatches(input).length, hasMinSpecialCharsMsg:(_, __)=>'some error')`
- `FormBuilderValidators.hasUppercaseChars(atLeast: n, regex: reg, errorText: 'some error')` is
equivalent to `Validators.hasMinUppercaseChars(min: n, customUppercaseCounter:(input)=>reg.allMatches(input).length, hasMinUppercaseCharsMsg:(_, __)=>'some error')`
|
About validators on new API.
Will be ideal that in some way we preserve the reference to old validators code. |
Connection with issue(s)
Close #???
Connected to #???
Solution description
Screenshots or Videos
To Do