Improve the output of the swagger API for watch events

Stopgap to improve this prior to converting watch resources to
versioned objects.
This commit is contained in:
Clayton Coleman
2015-04-07 10:45:18 -04:00
parent d2f4734657
commit 7a6b2ec227
5 changed files with 20 additions and 17 deletions

View File

@@ -357,6 +357,12 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
if err := addObjectParams(ws, route, versionedListOptions); err != nil {
return err
}
switch {
case isLister && isWatcher:
route.Doc("list or watch objects of kind " + kind)
case isWatcher:
route.Doc("watch objects of kind " + kind)
}
addParams(route, action.Params)
ws.Route(route)
case "PUT": // Update a resource.
@@ -405,7 +411,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
Doc("watch changes to an object of kind " + kind).
Operation("watch" + kind).
Produces("application/json").
Writes(watchjson.NewWatchEvent())
Writes(watchjson.WatchEvent{})
if err := addObjectParams(ws, route, versionedListOptions); err != nil {
return err
}
@@ -418,7 +424,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
Doc("watch individual changes to a list of " + kind).
Operation("watch" + kind + "list").
Produces("application/json").
Writes(watchjson.NewWatchEvent())
Writes(watchjson.WatchEvent{})
if err := addObjectParams(ws, route, versionedListOptions); err != nil {
return err
}