{"id":19036139,"url":"https://github.com/tx7do/kratos-swagger-ui","last_synced_at":"2026-03-07T23:31:44.490Z","repository":{"id":203879753,"uuid":"710591580","full_name":"tx7do/kratos-swagger-ui","owner":"tx7do","description":null,"archived":false,"fork":false,"pushed_at":"2025-12-24T02:10:03.000Z","size":35,"stargazers_count":11,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-25T15:30:33.952Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tx7do.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-27T02:48:06.000Z","updated_at":"2025-12-24T02:10:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"669cfa04-50b2-4a4c-b252-892f9699750c","html_url":"https://github.com/tx7do/kratos-swagger-ui","commit_stats":null,"previous_names":["tx7do/kratos-swagger-ui"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tx7do/kratos-swagger-ui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tx7do%2Fkratos-swagger-ui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tx7do%2Fkratos-swagger-ui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tx7do%2Fkratos-swagger-ui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tx7do%2Fkratos-swagger-ui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tx7do","download_url":"https://codeload.github.com/tx7do/kratos-swagger-ui/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tx7do%2Fkratos-swagger-ui/sbom","scorecard":{"id":904497,"data":{"date":"2025-08-11","repo":{"name":"github.com/tx7do/kratos-swagger-ui","commit":"09c0dbdb208dcd621eca581f7a467bffc63f44a4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/19 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":2,"reason":"1 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T16:51:05.155Z","repository_id":203879753,"created_at":"2025-08-24T16:51:05.155Z","updated_at":"2025-08-24T16:51:05.155Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30237329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T23:24:20.706Z","status":"ssl_error","status_checked_at":"2026-03-07T23:21:10.486Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T21:53:33.193Z","updated_at":"2026-03-07T23:31:44.439Z","avatar_url":"https://github.com/tx7do.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kratos-swagger-ui\r\n\r\n## How To Use\r\n\r\nat the first, you need install this lib:\r\n\r\n```shell\r\ngo get -u github.com/tx7do/kratos-swagger-ui\r\n```\r\n\r\ndirect use:\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"net/http\"\r\n\r\n\tswaggerUI \"github.com/tx7do/kratos-swagger-ui\"\r\n)\r\n\r\nfunc main() {\r\n\tswaggerHandler := swaggerUI.New(\r\n\t\t\"Petstore\",\r\n\t\t\"https://petstore3.swagger.io/api/v3/openapi.json\",\r\n\t\t\"/docs/\",\r\n\t)\r\n\r\n\thttp.Handle(\"/docs/\", swaggerHandler)\r\n\r\n\thttp.HandleFunc(\"/\", func(writer http.ResponseWriter, request *http.Request) {\r\n\t\t_, _ = writer.Write([]byte(\"Hello World!\"))\r\n\t})\r\n\r\n\tprintln(\"docs at http://localhost:8080/docs/\")\r\n\r\n\t_ = http.ListenAndServe(\"localhost:8080\", http.DefaultServeMux)\r\n}\r\n```\r\n\r\nuse it in kratos:\r\n\r\n```go\r\npackage server\r\n\r\nimport (\r\n\trest \"github.com/go-kratos/kratos/v2/transport/http\"\r\n\tswaggerUI \"github.com/tx7do/kratos-swagger-ui\"\r\n)\r\n\r\nfunc NewRESTServer() *rest.Server {\r\n\tsrv := CreateRestServer()\r\n\r\n\tswaggerHandler := swaggerUI.New(\r\n\t\t\"Petstore\",\r\n\t\t\"https://petstore3.swagger.io/api/v3/openapi.json\",\r\n\t\t\"/docs/\",\r\n\t)\r\n\tsrv.HandlePrefix(\"/docs/\", swaggerHandler)\r\n}\r\n\r\n```\r\n\r\nor\r\n\r\n```go\r\npackage server\r\n\r\nimport (\r\n\trest \"github.com/go-kratos/kratos/v2/transport/http\"\r\n\tswaggerUI \"github.com/tx7do/kratos-swagger-ui\"\r\n)\r\n\r\nfunc NewRESTServer() *rest.Server {\r\n\tsrv := CreateRestServer()\r\n\t\r\n\tswaggerUI.RegisterSwaggerUIServer(\r\n\t\tsrv,\r\n\t\t\"Petstore\",\r\n\t\t\"https://petstore3.swagger.io/api/v3/openapi.json\",\r\n\t\t\"/docs/\",\r\n\t)\r\n}\r\n\r\n```\r\n\r\n## Test Data\r\n\r\n### OpenAPI v2\r\n\r\n- Petstore JSON: \u003chttps://petstore.swagger.io/v2/swagger.json\u003e\r\n- Petstore YAML: \u003chttps://petstore.swagger.io/v2/swagger.yaml\u003e\r\n\r\n### OpenAPI v3\r\n\r\n- Petstore JSON: \u003chttps://petstore3.swagger.io/api/v3/openapi.json\u003e\r\n- Petstore YAML: \u003chttps://petstore3.swagger.io/api/v3/openapi.yaml\u003e\r\n\r\n## References\r\n\r\n- [Serve SwaggerUI within your Golang application](https://ribice.medium.com/serve-swaggerui-within-your-golang-application-5486748a5ed4)\r\n- [go-kratos swagger-api](https://github.com/go-kratos/swagger-api)\r\n- [swagger-ui - github](https://github.com/swagger-api/swagger-ui)\r\n- [Swagger Open API Specification 2.0 and 3.0 in Go](https://kecci.medium.com/swagger-open-api-specification-2-0-and-3-0-in-go-c1f05b51a595)\r\n- [Embedded Swagger UI for Go](https://github.com/swaggest/swgui)\r\n- [Tutorial: Developing a RESTful API with Go, JSON Schema validation and OpenAPI docs](https://dev.to/vearutop/tutorial-developing-a-restful-api-with-go-json-schema-validation-and-openapi-docs-2490)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftx7do%2Fkratos-swagger-ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftx7do%2Fkratos-swagger-ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftx7do%2Fkratos-swagger-ui/lists"}