vendor: update buildkit to master@8b7bcb900d3c

Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
Justin Chadwell
2023-03-29 12:38:36 +01:00
parent c6cdcb02cf
commit 9541457c54
416 changed files with 24398 additions and 16253 deletions

View File

@ -19,6 +19,8 @@ import (
"fmt"
"github.com/go-openapi/swag"
"k8s.io/kube-openapi/pkg/internal"
jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
)
// Swagger this is the root document object for the API specification.
@ -46,6 +48,10 @@ func (s Swagger) MarshalJSON() ([]byte, error) {
// UnmarshalJSON unmarshals a swagger spec from json
func (s *Swagger) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
return jsonv2.Unmarshal(data, s)
}
var sw Swagger
if err := json.Unmarshal(data, &sw.SwaggerProps); err != nil {
return err
@ -57,6 +63,30 @@ func (s *Swagger) UnmarshalJSON(data []byte) error {
return nil
}
func (s *Swagger) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
// Note: If you're willing to make breaking changes, it is possible to
// optimize this and other usages of this pattern:
// https://github.com/kubernetes/kube-openapi/pull/319#discussion_r983165948
var x struct {
Extensions
SwaggerProps
}
if err := opts.UnmarshalNext(dec, &x); err != nil {
return err
}
s.Extensions = x.Extensions
s.SwaggerProps = x.SwaggerProps
s.Extensions.sanitize()
if len(s.Extensions) == 0 {
s.Extensions = nil
}
return nil
}
// SwaggerProps captures the top-level properties of an Api specification
//
// NOTE: validation rules
@ -108,6 +138,10 @@ func (s SchemaOrBool) MarshalJSON() ([]byte, error) {
// UnmarshalJSON converts this bool or schema object from a JSON structure
func (s *SchemaOrBool) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
return jsonv2.Unmarshal(data, s)
}
var nw SchemaOrBool
if len(data) >= 4 {
if data[0] == '{' {
@ -123,6 +157,26 @@ func (s *SchemaOrBool) UnmarshalJSON(data []byte) error {
return nil
}
func (s *SchemaOrBool) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
switch k := dec.PeekKind(); k {
case '{':
err := opts.UnmarshalNext(dec, &s.Schema)
if err != nil {
return err
}
s.Allows = true
return nil
case 't', 'f':
err := opts.UnmarshalNext(dec, &s.Allows)
if err != nil {
return err
}
return nil
default:
return fmt.Errorf("expected object or bool, not '%v'", k.String())
}
}
// SchemaOrStringArray represents a schema or a string array
type SchemaOrStringArray struct {
Schema *Schema
@ -142,6 +196,10 @@ func (s SchemaOrStringArray) MarshalJSON() ([]byte, error) {
// UnmarshalJSON converts this schema object or array from a JSON structure
func (s *SchemaOrStringArray) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
return jsonv2.Unmarshal(data, s)
}
var first byte
if len(data) > 1 {
first = data[0]
@ -163,6 +221,18 @@ func (s *SchemaOrStringArray) UnmarshalJSON(data []byte) error {
return nil
}
func (s *SchemaOrStringArray) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
switch dec.PeekKind() {
case '{':
return opts.UnmarshalNext(dec, &s.Schema)
case '[':
return opts.UnmarshalNext(dec, &s.Property)
default:
_, err := dec.ReadValue()
return err
}
}
// Definitions contains the models explicitly defined in this spec
// An object to hold data types that can be consumed and produced by operations.
// These data types can be primitives, arrays or models.
@ -193,6 +263,10 @@ func (s StringOrArray) Contains(value string) bool {
// UnmarshalJSON unmarshals this string or array object from a JSON array or JSON string
func (s *StringOrArray) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
return jsonv2.Unmarshal(data, s)
}
var first byte
if len(data) > 1 {
first = data[0]
@ -223,6 +297,23 @@ func (s *StringOrArray) UnmarshalJSON(data []byte) error {
}
}
func (s *StringOrArray) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
switch k := dec.PeekKind(); k {
case '[':
*s = StringOrArray{}
return opts.UnmarshalNext(dec, (*[]string)(s))
case '"':
*s = StringOrArray{""}
return opts.UnmarshalNext(dec, &(*s)[0])
case 'n':
// Throw out null token
_, _ = dec.ReadToken()
return nil
default:
return fmt.Errorf("expected string or array, not '%v'", k.String())
}
}
// MarshalJSON converts this string or array to a JSON array or JSON string
func (s StringOrArray) MarshalJSON() ([]byte, error) {
if len(s) == 1 {
@ -264,6 +355,10 @@ func (s SchemaOrArray) MarshalJSON() ([]byte, error) {
// UnmarshalJSON converts this schema object or array from a JSON structure
func (s *SchemaOrArray) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
return jsonv2.Unmarshal(data, s)
}
var nw SchemaOrArray
var first byte
if len(data) > 1 {
@ -284,3 +379,15 @@ func (s *SchemaOrArray) UnmarshalJSON(data []byte) error {
*s = nw
return nil
}
func (s *SchemaOrArray) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
switch dec.PeekKind() {
case '{':
return opts.UnmarshalNext(dec, &s.Schema)
case '[':
return opts.UnmarshalNext(dec, &s.Schemas)
default:
_, err := dec.ReadValue()
return err
}
}