Update dependency go modules for k8s v1.26.0-rc.0

This commit is contained in:
Sunny Song
2022-11-23 00:44:15 +00:00
parent 1097a9601b
commit f095f3155b
373 changed files with 45668 additions and 4985 deletions

View File

@@ -19,15 +19,13 @@ package openapi
import (
"context"
openapi_v3 "github.com/google/gnostic/openapiv3"
"google.golang.org/protobuf/proto"
"k8s.io/kube-openapi/pkg/handler3"
)
const openAPIV3mimePb = "application/com.github.proto-openapi.spec.v3@v1.0+protobuf"
const ContentTypeOpenAPIV3PB = "application/com.github.proto-openapi.spec.v3@v1.0+protobuf"
type GroupVersion interface {
Schema() (*openapi_v3.Document, error)
Schema(contentType string) ([]byte, error)
}
type groupversion struct {
@@ -39,21 +37,10 @@ func newGroupVersion(client *client, item handler3.OpenAPIV3DiscoveryGroupVersio
return &groupversion{client: client, item: item}
}
func (g *groupversion) Schema() (*openapi_v3.Document, error) {
data, err := g.client.restClient.Get().
func (g *groupversion) Schema(contentType string) ([]byte, error) {
return g.client.restClient.Get().
RequestURI(g.item.ServerRelativeURL).
SetHeader("Accept", openAPIV3mimePb).
SetHeader("Accept", contentType).
Do(context.TODO()).
Raw()
if err != nil {
return nil, err
}
document := &openapi_v3.Document{}
if err := proto.Unmarshal(data, document); err != nil {
return nil, err
}
return document, nil
}