Generates OpenAPI (aka Swagger 2.0) Spec on /swagger.json path

This commit is contained in:
mbohlool
2016-08-18 08:12:26 -07:00
parent 0c51663aac
commit c5f1d63d6f
7 changed files with 1124 additions and 9 deletions

View File

@@ -54,6 +54,7 @@ import (
utilnet "k8s.io/kubernetes/pkg/util/net"
"k8s.io/kubernetes/plugin/pkg/admission/admit"
"github.com/go-openapi/spec"
"github.com/pborman/uuid"
)
@@ -134,6 +135,18 @@ func startMasterOrDie(masterConfig *master.Config) (*master.Master, *httptest.Se
masterConfig = NewMasterConfig()
masterConfig.EnableProfiling = true
masterConfig.EnableSwaggerSupport = true
masterConfig.EnableOpenAPISupport = true
masterConfig.OpenAPIInfo = spec.Info{
InfoProps: spec.InfoProps{
Title: "Kubernetes",
Version: "unversioned",
},
}
masterConfig.OpenAPIDefaultResponse = spec.Response{
ResponseProps: spec.ResponseProps{
Description: "Default Response.",
},
}
}
m, err := master.New(masterConfig)
if err != nil {