Skip to content

Conversation

martijn00
Copy link
Contributor

@martijn00 martijn00 commented May 27, 2024

Connection with issue(s)

Solution description

I've added a bunch of tests. There are some issues with null checks etc that should be fixed.

Screenshots or Videos

To Do

  • Read contributing guide
  • Check the original issue to confirm it is fully satisfied
  • Add solution description to help guide reviewers
  • Add unit test to verify new or fixed behaviour
  • If apply, add documentation to code properties and package readme
@deandreamatias
Copy link
Contributor

Maybe in this MR can add the think that I commented here #101 (review)

Validate a lot the all validators, is something important before publish a new version

@martijn00
Copy link
Contributor Author

@deandreamatias I can look into faker_dart but for now would first like to implement the current tests and get a release out. Are you adding it in #104 ?

@deandreamatias
Copy link
Contributor

We can add the two things.
My idea is implementing in #104

@martijn00
Copy link
Contributor Author

@deandreamatias I've done a couple of fixes but one thing i notice is inconsistency in handling null and '' string checks. In general should a empty string or null value pass a validation? I would think not? But in all the older code it does.

What is your opinion?

@martijn00 martijn00 changed the title More Tests Add some features and more tests May 29, 2024
@martijn00
Copy link
Contributor Author

@deandreamatias This one is finished now. I would prefer to refactor the inconsistency in handling null and '' and bump the whole release to a v11 with the breaking changes. If that is ok for you i'll make a new PR for that.

Copy link
Contributor

@deandreamatias deandreamatias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can define macro templates for regex (lib/src/utils/validators.dart) and add to validator dart doc to give more context

Example:

/// {@template hex_template} /// This regex match with ///  /// - Starts with a # character. /// - Is followed by exactly six characters, each of which is a hexadecimal digit (0-9, a-f, or A-f). /// - Has no additional characters before or after this pattern. ///  /// Examples: #1a2b3c and #ABCDEF /// {@endtemplate} RegExp _hex = RegExp(r'^#[0-9a-fA-F]{6}$')
/// {@macro hex_template} static FormFieldValidator<String> colorCode({
@deandreamatias
Copy link
Contributor

@martijn00 I don't know if empty string or null should be pass on validation. Maybe not.
I will take a look on code to understand better this behavior

@deandreamatias
Copy link
Contributor

deandreamatias commented May 29, 2024

Remember to use all templates create, like macro on validators

/// {@macro hex_template} static FormFieldValidator<String> colorCode({
@martijn00 martijn00 requested a review from deandreamatias May 30, 2024 08:28
@deandreamatias deandreamatias merged commit 30d696d into flutter-form-builder-ecosystem:main May 30, 2024
@martijn00
Copy link
Contributor Author

@deandreamatias thanks! I'll have a look at the null checks next. In general I think the behaviour should be that if a value is null or empty it should show the error message, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants