-
Notifications
You must be signed in to change notification settings - Fork 26
feat: Enable Custom Validators #654
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
Conversation
⏱️ Benchmark resultsComparing with 5aebba3
|
Codecov ReportBase: 47.16% // Head: 47.06% // Decreases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #654 +/- ##
==========================================
- Coverage 47.16% 47.06% -0.10%
==========================================
Files 70 70
Lines 6736 6750 +14
==========================================
Hits 3177 3177
- Misses 3111 3125 +14
Partials 448 448
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
erezrokah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, maybe you can share a PR that uses this?
I am working on one now in the AWS plugin to check for the Tags issue we just solved... cloudquery/cloudquery#7621 |
|
@erezrokah The initial pr for utilizing this functionality is up... It already found 5 issues... |
hermanschaaf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably define the Validator function signature as a type, but it's a minor nit 👍
yevgenypats
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Few thoughts on the validator interface
func(t *testing.T, table *schema.Table, resources *schema.Resource)
This way the SDK can do the same loop instead of the validator doing the loop again. Unless there is a need for the validator to have access to all tables but I feel it has those when it is calling the test anyway so feel a bit redundant.
Nit: per Herman comment type for the func would be nice.
I wanted to give the validator access to all of the tables so that it could validate/ensure consistency across multiple tables... I thought that the hit for performance is negligible...
will look into this |
But the validator already have access to all the tables because
But the validator already has in some sense access to all the tables. Anyway, if we want to pass the whole context to the validator, I think it makes sense but then let's just use the |
🤖 I have created a release *beep* *boop* --- ## [1.35.0](v1.34.0...v1.35.0) (2023-02-08) ### Features * Enable Custom Validators ([#654](#654)) ([6b7b5de](6b7b5de)) ### Bug Fixes * **deps:** Update module golang.org/x/term to v0.5.0 ([#648](#648)) ([3a02bed](3a02bed)) * Handle null bytes in text fields ([8597f08](8597f08)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Summary
Enable each individual plugin to pass in any and all additional validator functions they want...
Use the following steps to ensure your PR is ready to be reviewed
go fmtto format your code 🖊golangci-lint run🚨 (install golangci-lint here)