bump(github.com/go-openapi/spec): 7abd5745472fff5eb3685386d5fb8bf38683154d
This commit is contained in:
22
vendor/github.com/go-openapi/spec/items.go
generated
vendored
22
vendor/github.com/go-openapi/spec/items.go
generated
vendored
@@ -16,7 +16,9 @@ package spec
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/go-openapi/jsonpointer"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
@@ -60,11 +62,12 @@ type CommonValidations struct {
|
||||
// Items a limited subset of JSON-Schema's items object.
|
||||
// It is used by parameter definitions that are not located in "body".
|
||||
//
|
||||
// For more information: http://goo.gl/8us55a#items-object-
|
||||
// For more information: http://goo.gl/8us55a#items-object
|
||||
type Items struct {
|
||||
Refable
|
||||
CommonValidations
|
||||
SimpleSchema
|
||||
VendorExtensible
|
||||
}
|
||||
|
||||
// NewItems creates a new instance of items
|
||||
@@ -197,3 +200,20 @@ func (i Items) MarshalJSON() ([]byte, error) {
|
||||
}
|
||||
return swag.ConcatJSON(b3, b1, b2), nil
|
||||
}
|
||||
|
||||
// JSONLookup look up a value by the json property name
|
||||
func (p Items) JSONLookup(token string) (interface{}, error) {
|
||||
if token == "$ref" {
|
||||
return &p.Ref, nil
|
||||
}
|
||||
|
||||
r, _, err := jsonpointer.GetForToken(p.CommonValidations, token)
|
||||
if err != nil && !strings.HasPrefix(err.Error(), "object has no field") {
|
||||
return nil, err
|
||||
}
|
||||
if r != nil {
|
||||
return r, nil
|
||||
}
|
||||
r, _, err = jsonpointer.GetForToken(p.SimpleSchema, token)
|
||||
return r, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user