mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-05 04:38:16 +00:00
bump(github.com/go-openapi/spec): 7abd5745472fff5eb3685386d5fb8bf38683154d
This commit is contained in:
23
vendor/github.com/go-openapi/spec/response.go
generated
vendored
23
vendor/github.com/go-openapi/spec/response.go
generated
vendored
@@ -17,6 +17,7 @@ package spec
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/go-openapi/jsonpointer"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
@@ -34,6 +35,19 @@ type ResponseProps struct {
|
||||
type Response struct {
|
||||
Refable
|
||||
ResponseProps
|
||||
VendorExtensible
|
||||
}
|
||||
|
||||
// JSONLookup look up a value by the json property name
|
||||
func (p Response) JSONLookup(token string) (interface{}, error) {
|
||||
if ex, ok := p.Extensions[token]; ok {
|
||||
return &ex, nil
|
||||
}
|
||||
if token == "$ref" {
|
||||
return &p.Ref, nil
|
||||
}
|
||||
r, _, err := jsonpointer.GetForToken(p.ResponseProps, token)
|
||||
return r, err
|
||||
}
|
||||
|
||||
// UnmarshalJSON hydrates this items instance with the data from JSON
|
||||
@@ -44,6 +58,9 @@ func (r *Response) UnmarshalJSON(data []byte) error {
|
||||
if err := json.Unmarshal(data, &r.Refable); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := json.Unmarshal(data, &r.VendorExtensible); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -57,7 +74,11 @@ func (r Response) MarshalJSON() ([]byte, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return swag.ConcatJSON(b1, b2), nil
|
||||
b3, err := json.Marshal(r.VendorExtensible)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return swag.ConcatJSON(b1, b2, b3), nil
|
||||
}
|
||||
|
||||
// NewResponse creates a new response instance
|
||||
|
||||
Reference in New Issue
Block a user