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

Add Type system for object validation #5

Open
adamcyber1 opened this issue Mar 2, 2020 · 2 comments
Open

Add Type system for object validation #5

adamcyber1 opened this issue Mar 2, 2020 · 2 comments

Comments

@adamcyber1
Copy link
Owner

Internally, many of our data types are represented as strings, but we can perform some form of validation on these strings.

For example, a 'game id' normally looks like '2018021000', there are a few rules for what type of value this can actually be, since the first 4 characters are the season, the next 2 are the game type, and the next 4 are the game number.

Rather than use functions to validate all of our values, we can make custom classes like GameID that will do all this error checking for us. This will make it easy to add exceptions, black lists, whitelists etc.. since this can be done at the class instance level and the changes will automatically propagate through the entire program.

@c4llmeco4ch
Copy link

I'd be happy to work on this. Where would you like it placed? Probably in CLI? Since the value needs to be validated before pushing it out to the API?

@adamcyber1
Copy link
Owner Author

I recommend adding a Types module and start defining our internal Types, like GameID in this module. Then you can import Types wherever needed to perform the validation.

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

No branches or pull requests

2 participants