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

Create validation injector #7

Open
sradevski opened this issue Feb 24, 2019 · 0 comments
Open

Create validation injector #7

sradevski opened this issue Feb 24, 2019 · 0 comments
Labels
feature Larger feature requests

Comments

@sradevski
Copy link
Owner

Libraries that can be used internally for validation:

The validator can accept an array of "types" like unique, id, or custom validation functions.

General flow:

  • Get the hash value of each validation function.toString(), and store it in an object such as
const validators = {
[hashval]: () => null,
}
  • Iterate over each object in each definition
  • Get the validation function
  • If it is string, replace it with the hashval for that pre-defined function
  • If it is a function get the hash value of that function.toString(), add it to the rest of validators and replace it with the hash value.
  • At the end, you can potentially remove the unused pre-defined functions, but it is not necessary for a start.
  • Once all validators are generated, output them to a file exported as an object as the validators object above
  • In a separate file, create the validation executor which will be the connection between the validator functions and the hash value for each field in each definition.
@sradevski sradevski added the feature Larger feature requests label Feb 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Larger feature requests
Projects
None yet
Development

No branches or pull requests

1 participant