Skip to content
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

fix(code-gen): date validator should support special string cases #706

Merged
merged 1 commit into from
Feb 21, 2021

Conversation

dirkdev98
Copy link
Member

The Date validator now passes isOptional and allowNull values down to the string validator. So dates can be set to null or undefined if an empty string is passed in.

Closes #551

The Date validator now passes `isOptional` and `allowNull` values down to the string validator. So dates can be set to `null` or `undefined` if an empty string is passed in.

Closes #551
@github-actions
Copy link
Contributor

==== Benchmark result ====

Node.js version: 14
Total benchmarks: 15
          Passed: 15
          Failed: 0
-----------
router - github static path              200000  iterations    8003  ns/op
router - github path params              100000  iterations   10480  ns/op
compas validator simple                 5000000  iterations     264  ns/op
yup validator simple                     100000  iterations   12262  ns/op
fastest-validator validator simple     10000000  iterations     114  ns/op
compas validator nested                 1000000  iterations    1442  ns/op
yup validator nested                      50000  iterations   37931  ns/op
fastest-validator validator nested      2000000  iterations     548  ns/op
logger - strings                         500000  iterations    2578  ns/op
logger - objects                         500000  iterations    3242  ns/op
logger - deep objects                    200000  iterations    5859  ns/op
uuid                                    5000000  iterations     490  ns/op
uuid.isValid                           10000000  iterations     163  ns/op
isNil                                 500000000  iterations       0  ns/op
isPlainObject                         100000000  iterations      18  ns/op

@github-actions
Copy link
Contributor

==== C8 test coverage ====
Statements: 66.12% ( 25373/38373 )
Branches : 65.12% ( 2774 /4260 )
Functions : 66.93% ( 834 /1246 )
Lines : 66.12% ( 25373 /38373 )

@github-actions
Copy link
Contributor

==== Benchmark result ====

Node.js version: 15
Total benchmarks: 15
          Passed: 15
          Failed: 0
-----------
router - github static path              200000  iterations    8497  ns/op
router - github path params              100000  iterations   10462  ns/op
compas validator simple                 5000000  iterations     210  ns/op
yup validator simple                     200000  iterations   10270  ns/op
fastest-validator validator simple     20000000  iterations      84  ns/op
compas validator nested                 1000000  iterations    1198  ns/op
yup validator nested                      50000  iterations   37352  ns/op
fastest-validator validator nested      5000000  iterations     449  ns/op
logger - strings                         500000  iterations    2398  ns/op
logger - objects                         500000  iterations    2770  ns/op
logger - deep objects                    500000  iterations    4052  ns/op
uuid                                    5000000  iterations     316  ns/op
uuid.isValid                           10000000  iterations     120  ns/op
isNil                                 500000000  iterations       0  ns/op
isPlainObject                         100000000  iterations      15  ns/op

@dirkdev98 dirkdev98 merged commit 9b5543c into main Feb 21, 2021
@dirkdev98 dirkdev98 deleted the feat/date-allow-null branch February 21, 2021 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

code-gen: optional Date's should allow empty strings as well in validators
1 participant