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",
|
"swagger": "2.0",
|
||||||
"info": {
|
"info": {
|
||||||
"title": "Kubernetes",
|
"title": "Kubernetes",
|
||||||
"version": "unversioned"
|
"version": "v1.6.0"
|
||||||
},
|
},
|
||||||
"paths": {
|
"paths": {
|
||||||
"/api/": {
|
"/api/": {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"swagger": "2.0",
|
"swagger": "2.0",
|
||||||
"info": {
|
"info": {
|
||||||
"title": "Generic API Server",
|
"title": "Generic API Server",
|
||||||
"version": "unversioned"
|
"version": "v1.6.0"
|
||||||
},
|
},
|
||||||
"paths": {
|
"paths": {
|
||||||
"/api/": {
|
"/api/": {
|
||||||
|
|
|
@ -219,8 +219,7 @@ func DefaultOpenAPIConfig(definitions *openapicommon.OpenAPIDefinitions) *openap
|
||||||
IgnorePrefixes: []string{"/swaggerapi"},
|
IgnorePrefixes: []string{"/swaggerapi"},
|
||||||
Info: &spec.Info{
|
Info: &spec.Info{
|
||||||
InfoProps: spec.InfoProps{
|
InfoProps: spec.InfoProps{
|
||||||
Title: "Generic API Server",
|
Title: "Generic API Server",
|
||||||
Version: "unversioned",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
DefaultResponse: &spec.Response{
|
DefaultResponse: &spec.Response{
|
||||||
|
@ -548,6 +547,19 @@ func (c completedConfig) New() (*GenericAPIServer, error) {
|
||||||
|
|
||||||
s.HandlerContainer = mux.NewAPIContainer(http.NewServeMux(), c.Serializer)
|
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.installAPI(c.Config)
|
||||||
|
|
||||||
s.Handler, s.InsecureHandler = c.BuildHandlerChainsFunc(s.HandlerContainer.ServeMux, c.Config)
|
s.Handler, s.InsecureHandler = c.BuildHandlerChainsFunc(s.HandlerContainer.ServeMux, c.Config)
|
||||||
|
|
Loading…
Reference in New Issue