godeps: bump go-openapi

This commit is contained in:
Mike Danese 2018-02-13 18:30:26 -08:00
parent 6e856480c0
commit 1e90823c3b
11 changed files with 461 additions and 325 deletions

2
Godeps/Godeps.json generated
View File

@ -1251,7 +1251,7 @@
}, },
{ {
"ImportPath": "github.com/go-openapi/spec", "ImportPath": "github.com/go-openapi/spec",
"Rev": "7abd5745472fff5eb3685386d5fb8bf38683154d" "Rev": "1de3e0542de65ad8d75452a595886fdd0befb363"
}, },
{ {
"ImportPath": "github.com/go-openapi/strfmt", "ImportPath": "github.com/go-openapi/strfmt",

View File

@ -404,7 +404,7 @@
}, },
{ {
"ImportPath": "github.com/go-openapi/spec", "ImportPath": "github.com/go-openapi/spec",
"Rev": "7abd5745472fff5eb3685386d5fb8bf38683154d" "Rev": "1de3e0542de65ad8d75452a595886fdd0befb363"
}, },
{ {
"ImportPath": "github.com/go-openapi/strfmt", "ImportPath": "github.com/go-openapi/strfmt",

View File

@ -388,7 +388,7 @@
}, },
{ {
"ImportPath": "github.com/go-openapi/spec", "ImportPath": "github.com/go-openapi/spec",
"Rev": "7abd5745472fff5eb3685386d5fb8bf38683154d" "Rev": "1de3e0542de65ad8d75452a595886fdd0befb363"
}, },
{ {
"ImportPath": "github.com/go-openapi/swag", "ImportPath": "github.com/go-openapi/swag",

View File

@ -32,7 +32,7 @@
}, },
{ {
"ImportPath": "github.com/go-openapi/spec", "ImportPath": "github.com/go-openapi/spec",
"Rev": "7abd5745472fff5eb3685386d5fb8bf38683154d" "Rev": "1de3e0542de65ad8d75452a595886fdd0befb363"
}, },
{ {
"ImportPath": "github.com/go-openapi/swag", "ImportPath": "github.com/go-openapi/swag",

View File

@ -128,7 +128,7 @@
}, },
{ {
"ImportPath": "github.com/go-openapi/spec", "ImportPath": "github.com/go-openapi/spec",
"Rev": "7abd5745472fff5eb3685386d5fb8bf38683154d" "Rev": "1de3e0542de65ad8d75452a595886fdd0befb363"
}, },
{ {
"ImportPath": "github.com/go-openapi/swag", "ImportPath": "github.com/go-openapi/swag",

View File

@ -120,7 +120,7 @@
}, },
{ {
"ImportPath": "github.com/go-openapi/spec", "ImportPath": "github.com/go-openapi/spec",
"Rev": "7abd5745472fff5eb3685386d5fb8bf38683154d" "Rev": "1de3e0542de65ad8d75452a595886fdd0befb363"
}, },
{ {
"ImportPath": "github.com/go-openapi/swag", "ImportPath": "github.com/go-openapi/swag",

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,7 @@ type SimpleSchema struct {
Items *Items `json:"items,omitempty"` Items *Items `json:"items,omitempty"`
CollectionFormat string `json:"collectionFormat,omitempty"` CollectionFormat string `json:"collectionFormat,omitempty"`
Default interface{} `json:"default,omitempty"` Default interface{} `json:"default,omitempty"`
Example interface{} `json:"example,omitempty"`
} }
func (s *SimpleSchema) TypeName() string { func (s *SimpleSchema) TypeName() string {
@ -178,9 +179,14 @@ func (i *Items) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &simpleSchema); err != nil { if err := json.Unmarshal(data, &simpleSchema); err != nil {
return err return err
} }
var vendorExtensible VendorExtensible
if err := json.Unmarshal(data, &vendorExtensible); err != nil {
return err
}
i.Refable = ref i.Refable = ref
i.CommonValidations = validations i.CommonValidations = validations
i.SimpleSchema = simpleSchema i.SimpleSchema = simpleSchema
i.VendorExtensible = vendorExtensible
return nil return nil
} }
@ -198,7 +204,11 @@ func (i Items) MarshalJSON() ([]byte, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
return swag.ConcatJSON(b3, b1, b2), nil b4, err := json.Marshal(i.VendorExtensible)
if err != nil {
return nil, err
}
return swag.ConcatJSON(b4, b3, b1, b2), nil
} }
// JSONLookup look up a value by the json property name // JSONLookup look up a value by the json property name

View File

@ -31,11 +31,36 @@ type OperationProps struct {
ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
ID string `json:"operationId,omitempty"` ID string `json:"operationId,omitempty"`
Deprecated bool `json:"deprecated,omitempty"` Deprecated bool `json:"deprecated,omitempty"`
Security []map[string][]string `json:"security,omitempty"` Security []map[string][]string `json:"security,omitempty"` //Special case, see MarshalJSON function
Parameters []Parameter `json:"parameters,omitempty"` Parameters []Parameter `json:"parameters,omitempty"`
Responses *Responses `json:"responses,omitempty"` Responses *Responses `json:"responses,omitempty"`
} }
// MarshalJSON takes care of serializing operation properties to JSON
//
// We use a custom marhaller here to handle a special cases related
// the Security field. We need to preserve zero length slice
// while omiting the field when the value is nil/unset.
func (op OperationProps) MarshalJSON() ([]byte, error) {
type Alias OperationProps
if op.Security == nil {
return json.Marshal(&struct {
Security []map[string][]string `json:"security,omitempty"`
*Alias
}{
Security: op.Security,
Alias: (*Alias)(&op),
})
}
return json.Marshal(&struct {
Security []map[string][]string `json:"security"`
*Alias
}{
Security: op.Security,
Alias: (*Alias)(&op),
})
}
// Operation describes a single API operation on a path. // Operation describes a single API operation on a path.
// //
// For more information: http://goo.gl/8us55a#operationObject // For more information: http://goo.gl/8us55a#operationObject

View File

@ -145,7 +145,10 @@ func (r *Ref) UnmarshalJSON(d []byte) error {
if err := json.Unmarshal(d, &v); err != nil { if err := json.Unmarshal(d, &v); err != nil {
return err return err
} }
return r.fromMap(v)
}
func (r *Ref) fromMap(v map[string]interface{}) error {
if v == nil { if v == nil {
return nil return nil
} }

View File

@ -135,6 +135,10 @@ func (r *SchemaURL) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &v); err != nil { if err := json.Unmarshal(data, &v); err != nil {
return err return err
} }
return r.fromMap(v)
}
func (r *SchemaURL) fromMap(v map[string]interface{}) error {
if v == nil { if v == nil {
return nil return nil
} }
@ -582,18 +586,17 @@ func (s Schema) MarshalJSON() ([]byte, error) {
// UnmarshalJSON marshal this from JSON // UnmarshalJSON marshal this from JSON
func (s *Schema) UnmarshalJSON(data []byte) error { func (s *Schema) UnmarshalJSON(data []byte) error {
var sch Schema props := struct {
if err := json.Unmarshal(data, &sch.SchemaProps); err != nil { SchemaProps
SwaggerSchemaProps
}{}
if err := json.Unmarshal(data, &props); err != nil {
return err return err
} }
if err := json.Unmarshal(data, &sch.Ref); err != nil {
return err sch := Schema{
} SchemaProps: props.SchemaProps,
if err := json.Unmarshal(data, &sch.Schema); err != nil { SwaggerSchemaProps: props.SwaggerSchemaProps,
return err
}
if err := json.Unmarshal(data, &sch.SwaggerSchemaProps); err != nil {
return err
} }
var d map[string]interface{} var d map[string]interface{}
@ -601,6 +604,9 @@ func (s *Schema) UnmarshalJSON(data []byte) error {
return err return err
} }
sch.Ref.fromMap(d)
sch.Schema.fromMap(d)
delete(d, "$ref") delete(d, "$ref")
delete(d, "$schema") delete(d, "$schema")
for _, pn := range swag.DefaultJSONNameProvider.GetJSONNames(s) { for _, pn := range swag.DefaultJSONNameProvider.GetJSONNames(s) {