kubernetes / kubernetes/kubernetes

API-Linter: Add a verifier script using gengo to enforce API policies

Open
#44,005 7 comments 0 reactions 1 assignee Assigned to @roycaihw View on GitHub
lifecycle/frozen sig/api-machinery
Dominant language
Go
Stars
128k
Forks
44.3k
Avg merge
5d 17h
Merged PRs (30d)
208

Description

Right now we have several generator scripts (openapi-gen, deepcopy-gen, etc.) that look at the code and generate types/functions. This infrastructure can be used to look at all API types and enforce some policies such as optional fields to be pointer, etc. Please add the policies you want this verifier to enforce in this issue. I will start by a simple verifier for optional fields.

- [ ] Optional fields should be a pointer
- [ ] struct tag and comment tag should match for `patchStrategy` and `patchMergeKey`.
- [ ] `patchStrategy` tag should be used only if the field is a slice. (There are wrong usages in the API now)
- [ ] `patchMergeKey` tag should be used only with `patchStrategy` is `merge`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.