mirror of https://github.com/k3s-io/k3s
Merge pull request #37055 from mbohlool/dev
Automatic merge from submit-queue Add version to OpenAPI spec OpenAPI is missing a version string. It should follow kubernetes version. It is a bugfix that need to be cherrypicked in 1.5 too.pull/6/head
commit
5b391ae2e1
|
@ -2,7 +2,7 @@
|
|||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes",
|
||||
"version": "unversioned"
|
||||
"version": "v1.6.0"
|
||||
},
|
||||
"paths": {
|
||||
"/api/": {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Generic API Server",
|
||||
"version": "unversioned"
|
||||
"version": "v1.6.0"
|
||||
},
|
||||
"paths": {
|
||||
"/api/": {
|
||||
|
|
|
@ -219,8 +219,7 @@ func DefaultOpenAPIConfig(definitions *openapicommon.OpenAPIDefinitions) *openap
|
|||
IgnorePrefixes: []string{"/swaggerapi"},
|
||||
Info: &spec.Info{
|
||||
InfoProps: spec.InfoProps{
|
||||
Title: "Generic API Server",
|
||||
Version: "unversioned",
|
||||
Title: "Generic API Server",
|
||||
},
|
||||
},
|
||||
DefaultResponse: &spec.Response{
|
||||
|
@ -548,6 +547,19 @@ func (c completedConfig) New() (*GenericAPIServer, error) {
|
|||
|
||||
s.HandlerContainer = mux.NewAPIContainer(http.NewServeMux(), c.Serializer)
|
||||
|
||||
if s.openAPIConfig != nil {
|
||||
if s.openAPIConfig.Info == nil {
|
||||
s.openAPIConfig.Info = &spec.Info{}
|
||||
}
|
||||
if s.openAPIConfig.Info.Version == "" {
|
||||
if c.Version != nil {
|
||||
s.openAPIConfig.Info.Version = strings.Split(c.Version.String(), "-")[0]
|
||||
} else {
|
||||
s.openAPIConfig.Info.Version = "unversioned"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s.installAPI(c.Config)
|
||||
|
||||
s.Handler, s.InsecureHandler = c.BuildHandlerChainsFunc(s.HandlerContainer.ServeMux, c.Config)
|
||||
|
|
Loading…
Reference in New Issue