Pick up the latest updates to go-restful.

This commit is contained in:
Brendan Burns 2015-03-28 22:05:33 -07:00
parent 37689038d2
commit f826bf6b46
2 changed files with 16 additions and 2 deletions

4
Godeps/Godeps.json generated
View File

@ -170,8 +170,8 @@
},
{
"ImportPath": "github.com/emicklei/go-restful",
"Comment": "v1.1.3-29-gc68bc68",
"Rev": "c68bc68d7689f127ab554a42378aece0ea3df4b3"
"Comment": "v1.1.3-34-g5e1952e",
"Rev": "5e1952ed0806503c059e4463c2654200660f484b"
},
{
"ImportPath": "github.com/evanphx/json-patch",

View File

@ -106,6 +106,15 @@ func (b modelBuilder) buildProperty(field reflect.StructField, model *Model, mod
return b.buildArrayTypeProperty(field, jsonName, modelName)
case fieldKind == reflect.Ptr:
return b.buildPointerTypeProperty(field, jsonName, modelName)
case fieldKind == reflect.String:
stringt := "string"
prop.Type = &stringt
return jsonName, prop
case fieldKind == reflect.Map:
// if it's a map, it's unstructured, and swagger 1.2 can't handle it
anyt := "any"
prop.Type = &anyt
return jsonName, prop
}
if b.isPrimitiveType(fieldType.String()) {
@ -155,6 +164,10 @@ func (b modelBuilder) buildStructTypeProperty(field reflect.StructField, jsonNam
if required {
model.Required = append(model.Required, k)
}
// Add the model type to the global model list
if v.Ref != nil {
b.Models[*v.Ref] = sub.Models[*v.Ref]
}
}
// empty name signals skip property
return "", prop
@ -258,6 +271,7 @@ func (b modelBuilder) jsonSchemaType(modelName string) string {
"int": "integer",
"int32": "integer",
"int64": "integer",
"uint64": "integer",
"byte": "string",
"float64": "number",
"float32": "number",