Automatically generate V2 API specification

This changeset provides data structures and definitions describing the routes
available in the V2 registry API. These route descriptors are structured to
provide automated registration, for creating routers, in addition to complete
documentation duty. It's also a possibility that this could be used to
enumerate test coverage for server implementation.

Using this functionality, we've also developed a template to automatically
generate and API specification for submission into docker core.
This commit is contained in:
Stephen J Day 2014-12-18 18:21:57 -08:00
parent 3a46ac26d8
commit 06ebc514a7
8 changed files with 1717 additions and 141 deletions

View file

@ -140,7 +140,13 @@ func TestRouter(t *testing.T) {
},
} {
// Register the endpoint
router.GetRoute(testcase.RouteName).Handler(testHandler)
route := router.GetRoute(testcase.RouteName)
if route == nil {
t.Fatalf("route for name %q not found", testcase.RouteName)
}
route.Handler(testHandler)
u := server.URL + testcase.RequestURI
resp, err := http.Get(u)