Use local scheme for parameter decoding

This commit is contained in:
Darren Shepherd 2020-09-09 15:19:21 -07:00
parent e81a4e2c6e
commit 9b7fcc9a01

View File

@ -32,9 +32,15 @@ import (
)
var (
lowerChars = regexp.MustCompile("[a-z]+")
lowerChars = regexp.MustCompile("[a-z]+")
paramScheme = runtime.NewScheme()
paramCodec = runtime.NewParameterCodec(paramScheme)
)
func init() {
metav1.AddToGroupVersion(paramScheme, metav1.SchemeGroupVersion)
}
type ClientGetter interface {
IsImpersonating() bool
K8sInterface(ctx *types.APIRequest) (kubernetes.Interface, error)
@ -78,7 +84,7 @@ func (s *Store) ByID(apiOp *types.APIRequest, schema *types.APISchema, id string
}
func decodeParams(apiOp *types.APIRequest, target runtime.Object) error {
return metav1.ParameterCodec.DecodeParameters(apiOp.Request.URL.Query(), metav1.SchemeGroupVersion, target)
return paramCodec.DecodeParameters(apiOp.Request.URL.Query(), metav1.SchemeGroupVersion, target)
}
func toAPI(schema *types.APISchema, obj runtime.Object) types.APIObject {