mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-26 12:46:06 +00:00
Merge pull request #65737 from roycaihw/api-linter
Automatic merge from submit-queue (batch tested with PRs 64181, 65737). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. API linter framework and namesMatch API rule **What this PR does / why we need it**: Bump kube-openapi dependency to use the [API linter framework](https://github.com/kubernetes/kube-openapi/pull/83) in k/k OpenAPI spec generation procedure. Currently one API rule is enforced: "Go field names must be CamelCase. JSON field names must be camelCase. Other than capitalization of the initial letter, the two should almost always match. No underscores nor dashes in either." **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 #65244 **Special notes for your reviewer**: Most code change in this PR was generated (~1700 lines). Please see commits for detail. **Release note**: ```release-note NONE ``` /sig api-machinery /cc @pwittrock @mbohlool
This commit is contained in:
@@ -38,15 +38,17 @@ def openapi_library(name, tags, srcs, go_prefix, vendor_prefix = "", openapi_tar
|
||||
cmd = " ".join([
|
||||
"ORIG_WD=$$(pwd);",
|
||||
"cd $$GOPATH/src/" + go_prefix + ";",
|
||||
"$$ORIG_WD/$(location //vendor/k8s.io/code-generator/cmd/openapi-gen)",
|
||||
"$$ORIG_WD/$(location //vendor/k8s.io/kube-openapi/cmd/openapi-gen)",
|
||||
"--v 1",
|
||||
"--logtostderr",
|
||||
"--go-header-file $$ORIG_WD/$(location //" + vendor_prefix + "hack/boilerplate:boilerplate.go.txt)",
|
||||
"--output-file-base zz_generated.openapi",
|
||||
"--output-package " + go_prefix + "pkg/generated/openapi",
|
||||
"--report-filename tmp_api_violations.report",
|
||||
"--input-dirs " + ",".join([go_prefix + target for target in openapi_targets] + [go_prefix + "vendor/" + target for target in vendor_targets]),
|
||||
"&& cp $$GOPATH/src/" + go_prefix + "pkg/generated/openapi/zz_generated.openapi.go $$ORIG_WD/$(location :zz_generated.openapi.go)",
|
||||
"&& rm tmp_api_violations.report",
|
||||
]),
|
||||
go_deps = deps,
|
||||
tools = ["//vendor/k8s.io/code-generator/cmd/openapi-gen"],
|
||||
tools = ["//vendor/k8s.io/kube-openapi/cmd/openapi-gen"],
|
||||
)
|
||||
|
Reference in New Issue
Block a user