You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
In validation.js, we can see that it always create a new ajv instance, pass the whole validation: Object as schema to ajv.compile() to get validate function.
Then get validator: function and errorMessage: string from validation: Object by destructing assignment to follow-up action.
This mixed object and pipeline design might cause:
Hard to type checking and management
Potential risk of name conflict
Performance issue
Describe the solution you'd like
Use same props, but add schema property for holding ajv schema object.
Is your feature request related to a problem? Please describe.
In validation.js, we can see that it always create a new ajv instance, pass the whole
validation: Object
as schema toajv.compile()
to get validate function.Then get
validator: function
anderrorMessage: string
fromvalidation: Object
by destructing assignment to follow-up action.This mixed object and pipeline design might cause:
Describe the solution you'd like
Use same props, but add
schema
property for holding ajv schema object.Describe alternatives you've considered
Use different props instead.
Additional context about solution
We can get this properties by destructing assignment and create ajv instance only when
schema
existing.Typing
Also, we should complete the type definition of validation HoC.
For ajv usage, we can refer to ajv.d.ts
and keywords
And for customized validator, it will be following statement:
The text was updated successfully, but these errors were encountered: