From f826bf6b46385f3480e8198a8b9cba3101a41025 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Sat, 28 Mar 2015 22:05:33 -0700 Subject: [PATCH] Pick up the latest updates to go-restful. --- Godeps/Godeps.json | 4 ++-- .../emicklei/go-restful/swagger/model_builder.go | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index ac3802231be..77566be1179 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -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", diff --git a/Godeps/_workspace/src/github.com/emicklei/go-restful/swagger/model_builder.go b/Godeps/_workspace/src/github.com/emicklei/go-restful/swagger/model_builder.go index 5794df0f862..1fc58492ab8 100644 --- a/Godeps/_workspace/src/github.com/emicklei/go-restful/swagger/model_builder.go +++ b/Godeps/_workspace/src/github.com/emicklei/go-restful/swagger/model_builder.go @@ -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",