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

Implemented a generic approach for the addition of new validation types. #51

Closed
wants to merge 5 commits into from
Closed

Implemented a generic approach for the addition of new validation types. #51

wants to merge 5 commits into from

Conversation

Obirah
Copy link

@Obirah Obirah commented Sep 4, 2020

Fixes #50

Proposed Changes

  • Added "ReceiverValidator" parent class which can be implemented for any type to be validated.
  • Added concrete implementation of "ReceiverValidator" for "KFunction".
  • Adapted "Property" so that it extends "ReceiverValidator".
  • Adapted all the extension functions to use the generic "ReceiverValidator" type instead of "Property".

Draft

This Pull Request is a draft because I have not adapted the tests, yet. Please let me know if you like my approach and would consider merging it into the upstream. If so, I will adapt the tests so that each relevant test tests both KProperty and KFunction.

Also, I don't have any strong opinions on the naming, so feel free to suggest a better name than "ReceiverValidator" for the base class.

@Obirah
Copy link
Author

Obirah commented Sep 7, 2020

Would love to hear your opinion @rodolphocouto before I invest more time to make the code more generic and implement tests. :)

Edit: I now adapted one test in order to showcase the usage of the new functionality.

@Obirah
Copy link
Author

Obirah commented Oct 5, 2020

Moved on from valiktor and solved my problem another way.

@Obirah Obirah closed this Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Validator for value returned from a function
1 participant