-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Remove duplicated scaffold API validation code #1146
Conversation
Signed-off-by: Adrian Orive <[email protected]>
Hi @Adirio. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @droot |
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.
Hi @Adirio,
This change cannot be performed because when one of these values be not filled properly the user will not see a proper output and know what is missing. Following an example.
$ kubebuilder create api --group webapp --version --kind Guestbook
Create Resource [y/n]
y
Create Controller [y/n]
y
2019/11/04 23:29:26 kind cannot be empty
This error has nothing to do with my code, you can check it with the base kubebuilder and you will get the same. The error message will be written differently as they are not phrased the same, but it will still fail with the
|
This comment has been minimized.
This comment has been minimized.
As I mentioned in #1144, the The link you provided is exactly the function I'm calling in this PR (
It can be called either directly or thorugh `input.Validate` interface. The interface is only being called inside `Scaffold.Execute` which basically calls `Validate` on any file that has a method `Validate`. The direct method is being called in 33 tests (`pkg/scaffold/v1/resource/resource_test.go`), 8 v1 file types (`pkg/scaffold/v1/resource/`) and 7 v2 file types (`pkg/scaffold/v2/`, `pkg/scaffold/v2/crd/` and `pkg/scaffold/v2/webhook/`). The 15 file types for both versions just implement the `input.Validate` interface by calling the wrapped `Resource`, so the interface usage mention above applies to them. The 33 tests check most, if not all, of the corner cases directly on `Resource`s.
|
/assign @camilamacedo86 |
/assign @mengqiy |
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.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Adirio, mengqiy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Delegate resource validation to itself
Fixes #1145