-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update swagger info for SwaggerUI (#1009)
* fix: config argoCD and fluxCD by kubesphere.yaml * filter out ApiVersions that not start with /kapis * update swagger info
- Loading branch information
1 parent
6834bd0
commit 41bb584
Showing
5 changed files
with
33 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,14 +19,32 @@ package doc | |
import ( | ||
"github.com/emicklei/go-restful" | ||
swagger "github.com/emicklei/go-restful-swagger12" | ||
"kubesphere.io/devops/pkg/apiserver/runtime" | ||
"strings" | ||
) | ||
|
||
// AddSwaggerService adds the Swagger service | ||
func AddSwaggerService(wss []*restful.WebService, c *restful.Container) { | ||
var wssWithSchema []*restful.WebService | ||
for _, service := range wss { | ||
if strings.HasPrefix(service.RootPath(), runtime.ApiRootPath) { | ||
wssWithSchema = append(wssWithSchema, service) | ||
} | ||
} | ||
|
||
config := swagger.Config{ | ||
WebServices: wss, | ||
WebServices: wssWithSchema, | ||
ApiPath: "/apidocs.json", | ||
SwaggerPath: "/apidocs/", | ||
SwaggerFilePath: "bin/swagger-ui/dist"} | ||
SwaggerFilePath: "bin/swagger-ui/dist", | ||
Info: swagger.Info{ | ||
Title: "KubeSphere DevOps", | ||
Description: "KubeSphere DevOps OpenAPI", | ||
TermsOfServiceUrl: "https://kubesphere.io/", | ||
Contact: "[email protected]", | ||
License: "Apache 2.0", | ||
LicenseUrl: "https://www.apache.org/licenses/LICENSE-2.0.html", | ||
}, | ||
} | ||
swagger.RegisterSwaggerService(config, c) | ||
} |