Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
5bc62260
Commit
5bc62260
authored
Aug 18, 2016
by
Mike Danese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
godeps: update go-restful
parent
2166ce2f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
26 deletions
+38
-26
Godeps.json
Godeps/Godeps.json
+3
-6
README.md
vendor/github.com/emicklei/go-restful/README.md
+2
-2
container.go
vendor/github.com/emicklei/go-restful/container.go
+4
-4
install.sh
vendor/github.com/emicklei/go-restful/install.sh
+8
-7
model_builder.go
...r/github.com/emicklei/go-restful/swagger/model_builder.go
+13
-0
swagger.go
vendor/github.com/emicklei/go-restful/swagger/swagger.go
+1
-0
web_service.go
vendor/github.com/emicklei/go-restful/web_service.go
+7
-7
No files found.
Godeps/Godeps.json
View file @
5bc62260
...
@@ -852,18 +852,15 @@
...
@@ -852,18 +852,15 @@
},
},
{
{
"ImportPath"
:
"github.com/emicklei/go-restful"
,
"ImportPath"
:
"github.com/emicklei/go-restful"
,
"Comment"
:
"v1.2-66-gc4afa8e"
,
"Rev"
:
"89ef8af493ab468a45a42bb0d89a06fccdd2fb22"
"Rev"
:
"c4afa8e5421428d584b32d36d7b35f2c9ae5f823"
},
},
{
{
"ImportPath"
:
"github.com/emicklei/go-restful/log"
,
"ImportPath"
:
"github.com/emicklei/go-restful/log"
,
"Comment"
:
"v1.2-66-gc4afa8e"
,
"Rev"
:
"89ef8af493ab468a45a42bb0d89a06fccdd2fb22"
"Rev"
:
"c4afa8e5421428d584b32d36d7b35f2c9ae5f823"
},
},
{
{
"ImportPath"
:
"github.com/emicklei/go-restful/swagger"
,
"ImportPath"
:
"github.com/emicklei/go-restful/swagger"
,
"Comment"
:
"v1.2-66-gc4afa8e"
,
"Rev"
:
"89ef8af493ab468a45a42bb0d89a06fccdd2fb22"
"Rev"
:
"c4afa8e5421428d584b32d36d7b35f2c9ae5f823"
},
},
{
{
"ImportPath"
:
"github.com/evanphx/json-patch"
,
"ImportPath"
:
"github.com/evanphx/json-patch"
,
...
...
vendor/github.com/emicklei/go-restful/README.md
View file @
5bc62260
...
@@ -61,8 +61,8 @@ func (u UserResource) findUser(request *restful.Request, response *restful.Respo
...
@@ -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
)
-
[
Documentation on godoc.org
](
http://godoc.org/github.com/emicklei/go-restful
)
-
[
Code examples
](
https://github.com/emicklei/go-restful/tree/master/examples
)
-
[
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/
)
-
[
Example posted on blog
](
http://ernestmicklei.com/2012/11/go-restful-first-working-example/
)
-
[
Design explained on blog
](
http://ernestmicklei.com/2012/11/
11/
go-restful-api-design/
)
-
[
Design explained on blog
](
http://ernestmicklei.com/2012/11/go-restful-api-design/
)
-
[
sourcegraph
](
https://sourcegraph.com/github.com/emicklei/go-restful
)
-
[
sourcegraph
](
https://sourcegraph.com/github.com/emicklei/go-restful
)
-
[
gopkg.in
](
https://gopkg.in/emicklei/go-restful.v1
)
-
[
gopkg.in
](
https://gopkg.in/emicklei/go-restful.v1
)
-
[
showcase: Mora - MongoDB REST Api server
](
https://github.com/emicklei/mora
)
-
[
showcase: Mora - MongoDB REST Api server
](
https://github.com/emicklei/mora
)
...
...
vendor/github.com/emicklei/go-restful/container.go
View file @
5bc62260
...
@@ -283,12 +283,12 @@ func fixedPrefixPath(pathspec string) string {
...
@@ -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
// 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
)
c
.
ServeMux
.
ServeHTTP
(
httpwriter
,
httpRequest
)
}
}
// Handle registers the handler for the given pattern. If a handler already exists for pattern, Handle panics.
// 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
)
c
.
ServeMux
.
Handle
(
pattern
,
handler
)
}
}
...
@@ -318,7 +318,7 @@ func (c *Container) Filter(filter FilterFunction) {
...
@@ -318,7 +318,7 @@ func (c *Container) Filter(filter FilterFunction) {
}
}
// RegisteredWebServices returns the collections of added WebServices
// RegisteredWebServices returns the collections of added WebServices
func
(
c
Container
)
RegisteredWebServices
()
[]
*
WebService
{
func
(
c
*
Container
)
RegisteredWebServices
()
[]
*
WebService
{
c
.
webServicesLock
.
RLock
()
c
.
webServicesLock
.
RLock
()
defer
c
.
webServicesLock
.
RUnlock
()
defer
c
.
webServicesLock
.
RUnlock
()
result
:=
make
([]
*
WebService
,
len
(
c
.
webServices
))
result
:=
make
([]
*
WebService
,
len
(
c
.
webServices
))
...
@@ -329,7 +329,7 @@ func (c Container) RegisteredWebServices() []*WebService {
...
@@ -329,7 +329,7 @@ func (c Container) RegisteredWebServices() []*WebService {
}
}
// computeAllowedMethods returns a list of HTTP methods that are valid for a Request
// 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
// Go through all RegisteredWebServices() and all its Routes to collect the options
methods
:=
[]
string
{}
methods
:=
[]
string
{}
requestPath
:=
req
.
Request
.
URL
.
Path
requestPath
:=
req
.
Request
.
URL
.
Path
...
...
vendor/github.com/emicklei/go-restful/install.sh
View file @
5bc62260
cd
examples
go
test
-test
.v ...restful
&&
\
ls
*
.go | xargs
-I
{}
go build
-o
/tmp/ignore
{}
cd
..
go
fmt
...swagger
&&
\
go
test
-test
.v ...swagger
&&
\
go
test
-test
.v ...swagger
&&
\
go vet ...restful
&&
\
go
fmt
...swagger
&&
\
go
install
...swagger
&&
\
go
install
...swagger
&&
\
go
fmt
...restful
&&
\
go
fmt
...restful
&&
\
go
test
-test
.v ...restful
&&
\
go
install
...restful
go
install
...restful
cd
examples
\ No newline at end of file
ls
*
.go | xargs
-I
{}
go build
-o
/tmp/ignore
{}
cd
..
\ No newline at end of file
vendor/github.com/emicklei/go-restful/swagger/model_builder.go
View file @
5bc62260
...
@@ -51,6 +51,14 @@ func (b modelBuilder) addModel(st reflect.Type, nameOverride string) *Model {
...
@@ -51,6 +51,14 @@ func (b modelBuilder) addModel(st reflect.Type, nameOverride string) *Model {
if
b
.
isPrimitiveType
(
modelName
)
{
if
b
.
isPrimitiveType
(
modelName
)
{
return
nil
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
// see if we already have visited this model
if
_
,
ok
:=
b
.
Models
.
At
(
modelName
);
ok
{
if
_
,
ok
:=
b
.
Models
.
At
(
modelName
);
ok
{
return
nil
return
nil
...
@@ -276,6 +284,11 @@ func (b modelBuilder) buildArrayTypeProperty(field reflect.StructField, jsonName
...
@@ -276,6 +284,11 @@ func (b modelBuilder) buildArrayTypeProperty(field reflect.StructField, jsonName
return
jsonName
,
prop
return
jsonName
,
prop
}
}
fieldType
:=
field
.
Type
fieldType
:=
field
.
Type
if
fieldType
.
Elem
()
.
Kind
()
==
reflect
.
Uint8
{
stringt
:=
"string"
prop
.
Type
=
&
stringt
return
jsonName
,
prop
}
var
pType
=
"array"
var
pType
=
"array"
prop
.
Type
=
&
pType
prop
.
Type
=
&
pType
isPrimitive
:=
b
.
isPrimitiveType
(
fieldType
.
Elem
()
.
Name
())
isPrimitive
:=
b
.
isPrimitiveType
(
fieldType
.
Elem
()
.
Name
())
...
...
vendor/github.com/emicklei/go-restful/swagger/swagger.go
View file @
5bc62260
...
@@ -118,6 +118,7 @@ type ApiDeclaration struct {
...
@@ -118,6 +118,7 @@ type ApiDeclaration struct {
ApiVersion
string
`json:"apiVersion"`
ApiVersion
string
`json:"apiVersion"`
BasePath
string
`json:"basePath"`
BasePath
string
`json:"basePath"`
ResourcePath
string
`json:"resourcePath"`
// must start with /
ResourcePath
string
`json:"resourcePath"`
// must start with /
Info
Info
`json:"info"`
Apis
[]
Api
`json:"apis,omitempty"`
Apis
[]
Api
`json:"apis,omitempty"`
Models
ModelList
`json:"models,omitempty"`
Models
ModelList
`json:"models,omitempty"`
Produces
[]
string
`json:"produces,omitempty"`
Produces
[]
string
`json:"produces,omitempty"`
...
...
vendor/github.com/emicklei/go-restful/web_service.go
View file @
5bc62260
package
restful
package
restful
import
(
import
(
"
fmt
"
"
errors
"
"os"
"os"
"sync"
"sync"
...
@@ -51,7 +51,7 @@ func (w *WebService) ApiVersion(apiVersion string) *WebService {
...
@@ -51,7 +51,7 @@ func (w *WebService) ApiVersion(apiVersion string) *WebService {
}
}
// Version returns the API version for documentation purposes.
// 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.
// Path specifies the root URL template path of the WebService.
// All Routes will be relative to this path.
// All Routes will be relative to this path.
...
@@ -155,7 +155,7 @@ func (w *WebService) Route(builder *RouteBuilder) *WebService {
...
@@ -155,7 +155,7 @@ func (w *WebService) Route(builder *RouteBuilder) *WebService {
// RemoveRoute removes the specified route, looks for something that matches 'path' and 'method'
// RemoveRoute removes the specified route, looks for something that matches 'path' and 'method'
func
(
w
*
WebService
)
RemoveRoute
(
path
,
method
string
)
error
{
func
(
w
*
WebService
)
RemoveRoute
(
path
,
method
string
)
error
{
if
!
w
.
dynamicRoutes
{
if
!
w
.
dynamicRoutes
{
return
fmt
.
Errorf
(
"dynamic routes are not enabled."
)
return
errors
.
New
(
"dynamic routes are not enabled."
)
}
}
w
.
routesLock
.
Lock
()
w
.
routesLock
.
Lock
()
defer
w
.
routesLock
.
Unlock
()
defer
w
.
routesLock
.
Unlock
()
...
@@ -192,7 +192,7 @@ func (w *WebService) Consumes(accepts ...string) *WebService {
...
@@ -192,7 +192,7 @@ func (w *WebService) Consumes(accepts ...string) *WebService {
}
}
// Routes returns the Routes associated with this WebService
// Routes returns the Routes associated with this WebService
func
(
w
WebService
)
Routes
()
[]
Route
{
func
(
w
*
WebService
)
Routes
()
[]
Route
{
if
!
w
.
dynamicRoutes
{
if
!
w
.
dynamicRoutes
{
return
w
.
routes
return
w
.
routes
}
}
...
@@ -207,12 +207,12 @@ func (w WebService) Routes() []Route {
...
@@ -207,12 +207,12 @@ func (w WebService) Routes() []Route {
}
}
// RootPath returns the RootPath associated with this WebService. Default "/"
// RootPath returns the RootPath associated with this WebService. Default "/"
func
(
w
WebService
)
RootPath
()
string
{
func
(
w
*
WebService
)
RootPath
()
string
{
return
w
.
rootPath
return
w
.
rootPath
}
}
// PathParameters return the path parameter names for (shared amoung its Routes)
// PathParameters return the path parameter names for (shared amoung its Routes)
func
(
w
WebService
)
PathParameters
()
[]
*
Parameter
{
func
(
w
*
WebService
)
PathParameters
()
[]
*
Parameter
{
return
w
.
pathParameters
return
w
.
pathParameters
}
}
...
@@ -229,7 +229,7 @@ func (w *WebService) Doc(plainText string) *WebService {
...
@@ -229,7 +229,7 @@ func (w *WebService) Doc(plainText string) *WebService {
}
}
// Documentation returns it.
// Documentation returns it.
func
(
w
WebService
)
Documentation
()
string
{
func
(
w
*
WebService
)
Documentation
()
string
{
return
w
.
documentation
return
w
.
documentation
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment