-
Notifications
You must be signed in to change notification settings - Fork 211
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
Fully ignore unknown tags in ParseCommentTags #519
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -27,6 +27,7 @@ import ( | |||
"github.com/google/go-cmp/cmp" | ||||
"golang.org/x/tools/go/packages" | ||||
"golang.org/x/tools/go/packages/packagestest" | ||||
|
||||
"k8s.io/gengo/v2/generator" | ||||
"k8s.io/gengo/v2/namer" | ||||
"k8s.io/gengo/v2/parser" | ||||
|
@@ -2386,7 +2387,7 @@ func TestMarkerComments(t *testing.T) { | |||
// +k8s:validation:pattern="^foo$[0-9]+" | ||||
StringValue string | ||||
|
||||
// +k8s:validation:maxitems=10 | ||||
// +k8s:validation:maxItems=10 | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wondering why this passed the test before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because maxItems is never used to check anything in the test :( If the test had tried to exceed maxItems, it would have been allowed. I could just remove this validation rules to simplify the test case.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmm.. I think it is because the kube-openapi/pkg/generators/markers.go Line 411 in 9959940
maxItems and maxitems both are parsed. So the test actually passes with here remain as maxitems .
How about having a TODO and a more comprehensive test by a separate PR? i'm thinking maybe need to have an option for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not rely on that, I think the JSON we use in k/k is not case-insensitve There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. k/k is using https://github.com/kubernetes-sigs/json which is case sensitive There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll follow up on this in a separate issue. |
||||
// +k8s:validation:minItems=1 | ||||
// +k8s:validation:uniqueItems | ||||
ArrayValue []string | ||||
|
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.
Could you comment this - Would be nice to explain the expected "grammar" for a key here.
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.
Sure, added.
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.
not pushed?
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.
oops, pushed now