-
Notifications
You must be signed in to change notification settings - Fork 203
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
Move openapi proto parsing and indexing #10
Conversation
pkg/util/proto/doc.go
Outdated
limitations under the License. | ||
*/ | ||
|
||
// Package openapi is a collection of libraries for fetching the openapi spec |
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.
package proto. Also it does not fetch OpenAPI spec, right? only parsing and indexing.
pkg/util/proto/document.go
Outdated
return fmt.Errorf("SchemaError(%v): %v", path, err) | ||
} | ||
|
||
func VendorExtensionToMap(e []*openapi_v2.NamedAny) map[string]interface{} { |
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.
godoc on all public methods please.
pkg/util/proto/testing/gvk.go
Outdated
"k8s.io/kube-openapi/pkg/util/proto" | ||
) | ||
|
||
// groupVersionKindExtensionKey is the key used to lookup the |
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.
We should not have groupVersionKindExtensionKey here. The extension is kubernetes specific. I suggest you make it configurable somehow and set it in the importer of this code.
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.
Never mind, This is in test code. It is fine. nit: I would name it something like testExtensionKey and add it to the comment that only for testing we use some kubernetes spec that has this key.
Also please squash all commits into one. |
Updated. Squashed. Cut the test swagger to 10% size. |
kubectl OpenAPI bazel updates Print a newline after ginkgo tests so the test infra doesn't think that they fail Fixes #45279 Make OpenAPI GVK and Action extensions all lower-case Get cmd uses print-column extn from Openapi schema Get command now uses metadata x-kubernetes-print-columns, if present, in Openapi schema to format output for a resource. This functionality is guarded by a boolean flag 'use-openapi-print-columns'. manually fix kubectl openapi unit test openapi: Fetch protobuf rather than Json This is much faster. openapi: refactor into more generic structure Refactor the openapi schema to be a more generic structure that can be "visited" to get more specific types. openapi: Remove cache mechanism The cache will be removed and replaced with HTTP Etag caching instead. This patch is simply removing the existing mechanism. Revert "Merge pull request #47353 from apelisse/http-cache" This reverts commit fc89743dca6b563063b74728c3b28100cf674d9d, reversing changes made to 29ab38e898988c36e2de34f77fa33be556eb21bd. Autogenerate BUILD files Use buildozer to remove deprecated automanaged tags Use buildozer to delete licenses() rules except under third_party/ openapi: Move Fakes to testing package openapi: Add validation logic This allows validation of a yaml/json object against an openapi schema. A lot more testing would be needed to validate the logic, and also this is not plumbed in, so it can't be used by kubectl yet. Validate against OpenAPI schema (if available) openapi: Use "group" to look for resources openapi: Handle properly empty/null fileds openapi-validation: Handle List special case openapi validation: Ignore unknown types This follows the exact same logic as swagger. openapi: Change reference to be first-class References in the openapi are currently completely hidden from the model, and just passed through as we walk the tree. The problem is that they can have a different description and more importantly, different extensions. Change them to be first-class citizen, and fully part of the model. It means that visitors have to implement one more function and decide if something specific should be done with references. Validation is updated to just completely ignore them and passthrough (like it was done before). update pkg to not depend on other k8s repo
Ideally we would really like to test against the full swagger ( |
The openapi spec is not sync with main repo. We should not enforce it here. |
sgtm |
LGTM with assumption that this code is already code review-ed in the main repo. 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.
/lgtm
Automatic merge from submit-queue (batch tested with PRs 51739, 51762) Update vendor kube-openapi Update vendor to pick up some change in kube-openapi. The goal is to move some generic openapi parsing and indexing code to kube-openapi repo. Update the places that using it. #51321 will depend on this. fixes: #51822 kubernetes/kube-openapi#10 is the PR to move stuff to kube-openapi repo. ```release-note NONE ``` /assign @apelisse
migrate to travis and codecov
* fix kubernetes#10 - add error factor must be positive * fixed UT for new message
Move openapi proto parsing and indexing from main repo to this repo.
The code includes parsing and indexing logic.
They are NOT depend on any other k8s repo.
/assign @mbohlool @apelisse