update kube-openapi

hack/pin-dependency.sh k8s.io/kube-openapi 172d655c2280350c77cf05962948fc67ff043492
hack/update-vendor.sh
This commit is contained in:
Alexander Zielenski
2022-10-13 19:51:22 -07:00
parent 5113b705d2
commit f622dd918a
80 changed files with 10336 additions and 91 deletions

View File

@@ -18,6 +18,8 @@ import (
"encoding/json"
"github.com/go-openapi/swag"
"k8s.io/kube-openapi/pkg/internal"
jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
)
// OperationProps describes an operation
@@ -75,12 +77,34 @@ type Operation struct {
// UnmarshalJSON hydrates this items instance with the data from JSON
func (o *Operation) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
return jsonv2.Unmarshal(data, o)
}
if err := json.Unmarshal(data, &o.OperationProps); err != nil {
return err
}
return json.Unmarshal(data, &o.VendorExtensible)
}
func (o *Operation) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
type OperationPropsNoMethods OperationProps // strip MarshalJSON method
var x struct {
Extensions
OperationPropsNoMethods
}
if err := opts.UnmarshalNext(dec, &x); err != nil {
return err
}
x.Extensions.sanitize()
if len(x.Extensions) == 0 {
x.Extensions = nil
}
o.VendorExtensible.Extensions = x.Extensions
o.OperationProps = OperationProps(x.OperationPropsNoMethods)
return nil
}
// MarshalJSON converts this items object to JSON
func (o Operation) MarshalJSON() ([]byte, error) {
b1, err := json.Marshal(o.OperationProps)