mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-29 08:29:23 +00:00
Update OpenAPI and fix openAPI tests to handle unexported jsonreferences
Co-authored-by: Alexander Zielensk <alexzielenski@gmail.com> Kubernetes-commit: 700e3b566428bca46d2d37514c8fd7af60c7ff34
This commit is contained in:
parent
5295d256f6
commit
b5002f17ec
@ -56,3 +56,7 @@ func (g *groupversion) Schema(contentType string) ([]byte, error) {
|
||||
|
||||
return cachedInfo.data, cachedInfo.err
|
||||
}
|
||||
|
||||
func (c *groupversion) ServerRelativeURL() string {
|
||||
return c.delegate.ServerRelativeURL()
|
||||
}
|
||||
|
@ -27,6 +27,12 @@ const ContentTypeOpenAPIV3PB = "application/com.github.proto-openapi.spec.v3@v1.
|
||||
|
||||
type GroupVersion interface {
|
||||
Schema(contentType string) ([]byte, error)
|
||||
|
||||
// ServerRelativeURL. Returns the path and parameters used to fetch the schema.
|
||||
// You should use the Schema method to fetch it, but this value can be used
|
||||
// to key the current version of the schema in a cache since it contains a
|
||||
// hash string which changes upon schema update.
|
||||
ServerRelativeURL() string
|
||||
}
|
||||
|
||||
type groupversion struct {
|
||||
@ -68,3 +74,9 @@ func (g *groupversion) Schema(contentType string) ([]byte, error) {
|
||||
|
||||
return path.Do(context.TODO()).Raw()
|
||||
}
|
||||
|
||||
// URL used for fetching the schema. The URL includes a hash and can be used
|
||||
// to key the current version of the schema in a cache.
|
||||
func (g *groupversion) ServerRelativeURL() string {
|
||||
return g.item.ServerRelativeURL
|
||||
}
|
||||
|
@ -77,3 +77,8 @@ func (f FakeGroupVersion) Schema(contentType string) ([]byte, error) {
|
||||
}
|
||||
return f.GVSpec, nil
|
||||
}
|
||||
|
||||
// ServerRelativeURL returns an empty string.
|
||||
func (f FakeGroupVersion) ServerRelativeURL() string {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
@ -94,3 +94,8 @@ func (f *fileGroupVersion) Schema(contentType string) ([]byte, error) {
|
||||
}
|
||||
return fs.ReadFile(f.f, f.filename)
|
||||
}
|
||||
|
||||
// ServerRelativeURL returns an empty string.
|
||||
func (f *fileGroupVersion) ServerRelativeURL() string {
|
||||
return f.filename
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user