From 5bc62260dbb6d48c58d9233e26e7ccf33ab24b61 Mon Sep 17 00:00:00 2001 From: Mike Danese Date: Thu, 18 Aug 2016 11:24:14 -0700 Subject: [PATCH] godeps: update go-restful --- Godeps/Godeps.json | 9 +++------ vendor/github.com/emicklei/go-restful/README.md | 4 ++-- vendor/github.com/emicklei/go-restful/container.go | 8 ++++---- vendor/github.com/emicklei/go-restful/install.sh | 13 +++++++------ .../emicklei/go-restful/swagger/model_builder.go | 13 +++++++++++++ .../emicklei/go-restful/swagger/swagger.go | 1 + .../github.com/emicklei/go-restful/web_service.go | 14 +++++++------- 7 files changed, 37 insertions(+), 25 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 08461dbbc8d..26d6f56e160 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -852,18 +852,15 @@ }, { "ImportPath": "github.com/emicklei/go-restful", - "Comment": "v1.2-66-gc4afa8e", - "Rev": "c4afa8e5421428d584b32d36d7b35f2c9ae5f823" + "Rev": "89ef8af493ab468a45a42bb0d89a06fccdd2fb22" }, { "ImportPath": "github.com/emicklei/go-restful/log", - "Comment": "v1.2-66-gc4afa8e", - "Rev": "c4afa8e5421428d584b32d36d7b35f2c9ae5f823" + "Rev": "89ef8af493ab468a45a42bb0d89a06fccdd2fb22" }, { "ImportPath": "github.com/emicklei/go-restful/swagger", - "Comment": "v1.2-66-gc4afa8e", - "Rev": "c4afa8e5421428d584b32d36d7b35f2c9ae5f823" + "Rev": "89ef8af493ab468a45a42bb0d89a06fccdd2fb22" }, { "ImportPath": "github.com/evanphx/json-patch", diff --git a/vendor/github.com/emicklei/go-restful/README.md b/vendor/github.com/emicklei/go-restful/README.md index e5492e47672..cfe6d0a916b 100644 --- a/vendor/github.com/emicklei/go-restful/README.md +++ b/vendor/github.com/emicklei/go-restful/README.md @@ -61,8 +61,8 @@ func (u UserResource) findUser(request *restful.Request, response *restful.Respo - [Documentation on godoc.org](http://godoc.org/github.com/emicklei/go-restful) - [Code examples](https://github.com/emicklei/go-restful/tree/master/examples) -- [Example posted on blog](http://ernestmicklei.com/2012/11/24/go-restful-first-working-example/) -- [Design explained on blog](http://ernestmicklei.com/2012/11/11/go-restful-api-design/) +- [Example posted on blog](http://ernestmicklei.com/2012/11/go-restful-first-working-example/) +- [Design explained on blog](http://ernestmicklei.com/2012/11/go-restful-api-design/) - [sourcegraph](https://sourcegraph.com/github.com/emicklei/go-restful) - [gopkg.in](https://gopkg.in/emicklei/go-restful.v1) - [showcase: Mora - MongoDB REST Api server](https://github.com/emicklei/mora) diff --git a/vendor/github.com/emicklei/go-restful/container.go b/vendor/github.com/emicklei/go-restful/container.go index 62ded27c71b..4e53cccb933 100644 --- a/vendor/github.com/emicklei/go-restful/container.go +++ b/vendor/github.com/emicklei/go-restful/container.go @@ -283,12 +283,12 @@ func fixedPrefixPath(pathspec string) string { } // ServeHTTP implements net/http.Handler therefore a Container can be a Handler in a http.Server -func (c Container) ServeHTTP(httpwriter http.ResponseWriter, httpRequest *http.Request) { +func (c *Container) ServeHTTP(httpwriter http.ResponseWriter, httpRequest *http.Request) { c.ServeMux.ServeHTTP(httpwriter, httpRequest) } // Handle registers the handler for the given pattern. If a handler already exists for pattern, Handle panics. -func (c Container) Handle(pattern string, handler http.Handler) { +func (c *Container) Handle(pattern string, handler http.Handler) { c.ServeMux.Handle(pattern, handler) } @@ -318,7 +318,7 @@ func (c *Container) Filter(filter FilterFunction) { } // RegisteredWebServices returns the collections of added WebServices -func (c Container) RegisteredWebServices() []*WebService { +func (c *Container) RegisteredWebServices() []*WebService { c.webServicesLock.RLock() defer c.webServicesLock.RUnlock() result := make([]*WebService, len(c.webServices)) @@ -329,7 +329,7 @@ func (c Container) RegisteredWebServices() []*WebService { } // computeAllowedMethods returns a list of HTTP methods that are valid for a Request -func (c Container) computeAllowedMethods(req *Request) []string { +func (c *Container) computeAllowedMethods(req *Request) []string { // Go through all RegisteredWebServices() and all its Routes to collect the options methods := []string{} requestPath := req.Request.URL.Path diff --git a/vendor/github.com/emicklei/go-restful/install.sh b/vendor/github.com/emicklei/go-restful/install.sh index 5fe03b56978..36cbf25f82a 100644 --- a/vendor/github.com/emicklei/go-restful/install.sh +++ b/vendor/github.com/emicklei/go-restful/install.sh @@ -1,9 +1,10 @@ -cd examples - ls *.go | xargs -I {} go build -o /tmp/ignore {} - cd .. -go fmt ...swagger && \ +go test -test.v ...restful && \ go test -test.v ...swagger && \ +go vet ...restful && \ +go fmt ...swagger && \ go install ...swagger && \ go fmt ...restful && \ -go test -test.v ...restful && \ -go install ...restful \ No newline at end of file +go install ...restful +cd examples + ls *.go | xargs -I {} go build -o /tmp/ignore {} + cd .. \ No newline at end of file diff --git a/vendor/github.com/emicklei/go-restful/swagger/model_builder.go b/vendor/github.com/emicklei/go-restful/swagger/model_builder.go index 696d192e5bc..398e83049c4 100644 --- a/vendor/github.com/emicklei/go-restful/swagger/model_builder.go +++ b/vendor/github.com/emicklei/go-restful/swagger/model_builder.go @@ -51,6 +51,14 @@ func (b modelBuilder) addModel(st reflect.Type, nameOverride string) *Model { if b.isPrimitiveType(modelName) { return nil } + // golang encoding/json packages says array and slice values encode as + // JSON arrays, except that []byte encodes as a base64-encoded string. + // If we see a []byte here, treat it at as a primitive type (string) + // and deal with it in buildArrayTypeProperty. + if (st.Kind() == reflect.Slice || st.Kind() == reflect.Array) && + st.Elem().Kind() == reflect.Uint8 { + return nil + } // see if we already have visited this model if _, ok := b.Models.At(modelName); ok { return nil @@ -276,6 +284,11 @@ func (b modelBuilder) buildArrayTypeProperty(field reflect.StructField, jsonName return jsonName, prop } fieldType := field.Type + if fieldType.Elem().Kind() == reflect.Uint8 { + stringt := "string" + prop.Type = &stringt + return jsonName, prop + } var pType = "array" prop.Type = &pType isPrimitive := b.isPrimitiveType(fieldType.Elem().Name()) diff --git a/vendor/github.com/emicklei/go-restful/swagger/swagger.go b/vendor/github.com/emicklei/go-restful/swagger/swagger.go index 967b6711e8b..9c40833e7da 100644 --- a/vendor/github.com/emicklei/go-restful/swagger/swagger.go +++ b/vendor/github.com/emicklei/go-restful/swagger/swagger.go @@ -118,6 +118,7 @@ type ApiDeclaration struct { ApiVersion string `json:"apiVersion"` BasePath string `json:"basePath"` ResourcePath string `json:"resourcePath"` // must start with / + Info Info `json:"info"` Apis []Api `json:"apis,omitempty"` Models ModelList `json:"models,omitempty"` Produces []string `json:"produces,omitempty"` diff --git a/vendor/github.com/emicklei/go-restful/web_service.go b/vendor/github.com/emicklei/go-restful/web_service.go index 24fc5328b14..2a51004f802 100644 --- a/vendor/github.com/emicklei/go-restful/web_service.go +++ b/vendor/github.com/emicklei/go-restful/web_service.go @@ -1,7 +1,7 @@ package restful import ( - "fmt" + "errors" "os" "sync" @@ -51,7 +51,7 @@ func (w *WebService) ApiVersion(apiVersion string) *WebService { } // Version returns the API version for documentation purposes. -func (w WebService) Version() string { return w.apiVersion } +func (w *WebService) Version() string { return w.apiVersion } // Path specifies the root URL template path of the WebService. // All Routes will be relative to this path. @@ -155,7 +155,7 @@ func (w *WebService) Route(builder *RouteBuilder) *WebService { // RemoveRoute removes the specified route, looks for something that matches 'path' and 'method' func (w *WebService) RemoveRoute(path, method string) error { if !w.dynamicRoutes { - return fmt.Errorf("dynamic routes are not enabled.") + return errors.New("dynamic routes are not enabled.") } w.routesLock.Lock() defer w.routesLock.Unlock() @@ -192,7 +192,7 @@ func (w *WebService) Consumes(accepts ...string) *WebService { } // Routes returns the Routes associated with this WebService -func (w WebService) Routes() []Route { +func (w *WebService) Routes() []Route { if !w.dynamicRoutes { return w.routes } @@ -207,12 +207,12 @@ func (w WebService) Routes() []Route { } // RootPath returns the RootPath associated with this WebService. Default "/" -func (w WebService) RootPath() string { +func (w *WebService) RootPath() string { return w.rootPath } // PathParameters return the path parameter names for (shared amoung its Routes) -func (w WebService) PathParameters() []*Parameter { +func (w *WebService) PathParameters() []*Parameter { return w.pathParameters } @@ -229,7 +229,7 @@ func (w *WebService) Doc(plainText string) *WebService { } // Documentation returns it. -func (w WebService) Documentation() string { +func (w *WebService) Documentation() string { return w.documentation }