-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
🌱 Enable optionalorrequired linter #11909
🌱 Enable optionalorrequired linter #11909
Conversation
b85a8d2
to
d26f462
Compare
d26f462
to
7e640c3
Compare
7931667
to
df77f96
Compare
Hi @sbueringer |
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.
Reviewing the additions of markers, everything here looks in order as far as I can tell. Just one nit about making sure we have the order of the enabled linters correct, and then good to go, thanks @sivchari
metav1.ListMeta `json:"metadata,omitempty"` | ||
// items is the list of Clusters. | ||
// +optional | ||
Items []Cluster `json:"items"` |
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.
Why are we making this optional? Shouldn't this be required? (see also the delta in zz_generated.openapi.go)
(cc @JoelSpeed)
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.
Exactly, thanks.
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.
What do you mean with exactly? :)
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.
Edited comments were not reflected.
required is correct here, ideally zz_generated_api.go should not be changed!
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.
In general, the List version of a resource doesn't matter too much, it doesn't effect the generated CRD or behaviour of the cluster, but does affect the openapi as you've seen.
I'm intending to check with API machinery folks about their expectations here, whether this should be optional or required and from there will set up the linters to ensure consistency.
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.
If getting that feedback from apimachinery takes too long I would suggest to drop all the markers for the Items field for now. Then we can get at least everything else done for the code freeze
(I don't want to block everything else on this PR just for a marker that don't have any impact anywhere (not in CRDs and the generated OpenAPI code is as far as I know only used to generate some specs for Runtime Extensions that don't even use lists)
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.
Thinking a bit about it. @sivchari Can we directly remove the markers from the Items fields on this PR, add an exclude and follow-up? I have multiple other PRs with potential merge conflicts that I have to coordinate with this PR
(adding the Items markers later is trivial)
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.
@sbueringer
Make sense to me, thanks.
I fixed them.
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.
Thx!
df77f96
to
f8c8a78
Compare
bc94f70
to
5a1745d
Compare
Deletion line is 1. |
5a1745d
to
08fe0ad
Compare
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.
@sivchari Thx! Last round of nits. Sorry these non-CRD API types are a bit strange and there's a lot of nuance
Basically optional/required has no impact on them as they are not used for CRDs, but I still don't want to declare fields as required that are actually optional (adding omitempty to a bunch of these won't change their behavior at runtime)
But I think even though these are not used in CRDs it's good to explicitly declare if the fields are optional or required.
08fe0ad
to
0fe20eb
Compare
I fixed all them that you commented! |
7db7cda
to
91c760d
Compare
Seems like the exclude doesn't cover the Provider CRD + we need regen (the diff there is fine) |
91c760d
to
ac2d1c7
Compare
I edited exclude ranges and did re-gen 👍 |
Signed-off-by: sivchari <[email protected]>
ac2d1c7
to
c2e43bb
Compare
Thank you! Really appreciate the work on this. I know it was a lot of work :) /lgtm |
LGTM label has been added. Git tree hash: f9db9a4d11dae5fdba7fe62d3023cef0fb9ea98a
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbueringer 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 |
I added a sub-task on #11834 to track the Items work. Feel free to continue with that one :) |
What this PR does / why we need it:
Part of #11834
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
/area api