check-rule-mate (auto documentation + playground example)

Visual documentation of validation rules and schemas.

Schema: contactUs

Field Rule Required Cache
name name
lastName name
email email off
emailConfirm email--confirm off
phone phone optional
subject hasText
message hasText
Schema Test (Experimental)
Result:

Schema: customerCreation

Field Rule Required Cache
name name
lastName name optional
birthdate date--age
cpf cpf
email email
phone phone
Schema Test (Experimental)
Result:

Schema: myAccount

Field Rule Required Cache
name name
lastName name optional
birthdate date--age
cpf cpf
email email
emailConfirm email--confirm
phone phone
Schema Test (Experimental)
Result:

Schema: nameSpecialValidationRules

Field Rule Required Cache
name name
cellphone phone
email email
Schema Test (Experimental)
Result:

Rule: name (myValidatorRules)

Used to validate names based if they have text or not.

Validation Flow

hasText
valid

Error Codes

Used by Schemas

Notes

You can add your special note here.

Rule: hasText (myValidatorRules)

Used to validate if a text field is not blank.

Validation Flow

hasText
valid

Error Codes

Used by Schemas

Rule: email (myValidatorRules)

Used to validate email fields. Checking if hasText and if matches with a valid format for emails.

Validation Flow

regex
valid

Error Codes

Modifiers

confirm

Used to validate if email confirm fields are valid emails and matches with the primary email field.

regex
equals
valid

Error Codes

Used by Schemas

Notes

To use email confirm modifier use email--confirm

Rule: phone (myValidatorRules)

Checks if phone number has a valid format.

Validation Flow

regex
valid

Error Codes

Used by Schemas

Notes

Only works for Brazilian's phone numbers

Rule: date (myValidatorRules)

Used to validate a date format in date or string fields

Validation Flow

regex
validDate
valid

Error Codes

Modifiers

age
regex
validateAge
valid

Error Codes

Used by Schemas

Notes

Can validate someone age based on birthdate through the date--age modifier

Rule: cpf (myValidatorRules)

Used to check if someone CPF is valid or not

Validation Flow

cpf
valid

Error Codes

Used by Schemas

Notes

CPF is a ID document which only works in Brazil

Rule: name (nameSpecialValidationRules)

Validation Flow

nameSpecialValidation
valid

Error Codes

Used by Schemas

Error: common (myValidatorRules)

Used by Rules

Error: email (myValidatorRules)

Used by Rules

Error: phone (myValidatorRules)

Used by Rules

Error: date (myValidatorRules)

Used by Rules

Error: cpf (myValidatorRules)

Used by Rules

Error: name (myValidatorRules)

Used by Rules