{"id":13438731,"url":"https://github.com/emicklei/go-restful","last_synced_at":"2025-09-09T20:26:04.038Z","repository":{"id":5501701,"uuid":"6701057","full_name":"emicklei/go-restful","owner":"emicklei","description":"package for building REST-style Web Services using Go","archived":false,"fork":false,"pushed_at":"2025-08-26T13:31:28.000Z","size":6239,"stargazers_count":5100,"open_issues_count":3,"forks_count":683,"subscribers_count":147,"default_branch":"v3","last_synced_at":"2025-09-05T01:23:26.255Z","etag":null,"topics":["customizable","go","openapi","rest","routing"],"latest_commit_sha":null,"homepage":"","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/emicklei.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2012-11-15T07:31:43.000Z","updated_at":"2025-08-28T08:19:33.000Z","dependencies_parsed_at":"2024-01-17T00:54:52.450Z","dependency_job_id":"6836038b-6120-487c-8b1c-549b7ae0e93e","html_url":"https://github.com/emicklei/go-restful","commit_stats":{"total_commits":758,"total_committers":120,"mean_commits":6.316666666666666,"dds":0.3720316622691293,"last_synced_commit":"bcbb0e63c09b769909ffcf9a1b3c0a35a1cb284b"},"previous_names":[],"tags_count":72,"template":false,"template_full_name":null,"purl":"pkg:github/emicklei/go-restful","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fgo-restful","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fgo-restful/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fgo-restful/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fgo-restful/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emicklei","download_url":"https://codeload.github.com/emicklei/go-restful/tar.gz/refs/heads/v3","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fgo-restful/sbom","scorecard":{"id":375363,"data":{"date":"2025-08-11","repo":{"name":"github.com/emicklei/go-restful","commit":"4c1b61ed04e0626ea7d3442373af9b8f1d334a3b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.9,"checks":[{"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":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: topLevel 'contents' permission set to 'read': .github/workflows/go.yml:10","Info: no jobLevel write permissions found"],"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":"Code-Review","score":5,"reason":"Found 8/16 approved changesets -- score normalized to 5","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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"Pinned-Dependencies","score":10,"reason":"all dependencies are pinned","details":["Info:   2 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   2 out of   2 third-party GitHubAction dependencies pinned"],"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":"Maintained","score":5,"reason":"6 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Security-Policy","score":4,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Warn: no linked content found","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"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":"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":"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":"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 'v3'","Warn: branch protection not enabled for branch 'master'"],"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 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"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2024-2958 / GHSA-3669-72x9-r9p3","Warn: Project is vulnerable to: GO-2024-3250 / GHSA-29wx-vh33-7x7r","Warn: Project is vulnerable to: GO-2025-3553 / GHSA-mh63-6h87-95cp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T14:08:35.058Z","repository_id":5501701,"created_at":"2025-08-18T14:08:35.058Z","updated_at":"2025-08-18T14:08:35.058Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274357608,"owners_count":25270675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["customizable","go","openapi","rest","routing"],"created_at":"2024-07-31T03:01:07.956Z","updated_at":"2025-09-09T20:26:04.015Z","avatar_url":"https://github.com/emicklei.png","language":"Go","funding_links":[],"categories":["`API Frameworks`","HarmonyOS","Go","Servers","web  框架","API Frameworks","Repositories","API and RPC"],"sub_categories":["Go","Windows Manager","Advanced and Specialized Tools"],"readme":"go-restful\n==========\npackage for building REST-style Web Services using Google Go\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/emicklei/go-restful)](https://goreportcard.com/report/github.com/emicklei/go-restful)\n[![Go Reference](https://pkg.go.dev/badge/github.com/emicklei/go-restful.svg)](https://pkg.go.dev/github.com/emicklei/go-restful/v3)\n[![codecov](https://codecov.io/gh/emicklei/go-restful/branch/master/graph/badge.svg)](https://codecov.io/gh/emicklei/go-restful)\n\n- [Code examples use v3](https://github.com/emicklei/go-restful/tree/v3/examples)\n\nREST asks developers to use HTTP methods explicitly and in a way that's consistent with the protocol definition. This basic REST design principle establishes a one-to-one mapping between create, read, update, and delete (CRUD) operations and HTTP methods. According to this mapping:\n\n- GET = Retrieve a representation of a resource\n- POST = Create if you are sending content to the server to create a subordinate of the specified resource collection, using some server-side algorithm.\n- PUT = Create if you are sending the full content of the specified resource (URI).\n- PUT = Update if you are updating the full content of the specified resource.\n- DELETE = Delete if you are requesting the server to delete the resource\n- PATCH = Update partial content of a resource\n- OPTIONS = Get information about the communication options for the request URI\n    \n### Usage\n\n#### Without Go Modules\n\nAll versions up to `v2.*.*` (on the master) are not supporting Go modules.\n\n```\nimport (\n\trestful \"github.com/emicklei/go-restful\"\n)\n```\n\n#### Using Go Modules\n\nAs of version `v3.0.0` (on the v3 branch), this package supports Go modules.\n\n```\nimport (\n\trestful \"github.com/emicklei/go-restful/v3\"\n)\n```\n\n### Example\n\n```Go\nws := new(restful.WebService)\nws.\n\tPath(\"/users\").\n\tConsumes(restful.MIME_XML, restful.MIME_JSON).\n\tProduces(restful.MIME_JSON, restful.MIME_XML)\n\nws.Route(ws.GET(\"/{user-id}\").To(u.findUser).\n\tDoc(\"get a user\").\n\tParam(ws.PathParameter(\"user-id\", \"identifier of the user\").DataType(\"string\")).\n\tWrites(User{}))\t\t\n...\n\t\nfunc (u UserResource) findUser(request *restful.Request, response *restful.Response) {\n\tid := request.PathParameter(\"user-id\")\n\t...\n}\n```\n\t\n[Full API of a UserResource](https://github.com/emicklei/go-restful/blob/v3/examples/user-resource/restful-user-resource.go) \n\t\t\n### Features\n\n- Routes for request \u0026#8594; function mapping with path parameter (e.g. {id} but also prefix_{var} and {var}_suffix) support\n- Configurable router:\n\t- (default) Fast routing algorithm that allows static elements, [google custom method](https://cloud.google.com/apis/design/custom_methods), regular expressions and dynamic parameters in the URL path (e.g. /resource/name:customVerb, /meetings/{id} or /static/{subpath:*})\n\t- Routing algorithm after [JSR311](http://jsr311.java.net/nonav/releases/1.1/spec/spec.html) that is implemented using (but does **not** accept) regular expressions\n- Request API for reading structs from JSON/XML and accessing parameters (path,query,header)\n- Response API for writing structs to JSON/XML and setting headers\n- Customizable encoding using EntityReaderWriter registration\n- Filters for intercepting the request \u0026#8594; response flow on Service or Route level\n- Request-scoped variables using attributes\n- Containers for WebServices on different HTTP endpoints\n- Content encoding (gzip,deflate) of request and response payloads\n- Automatic responses on OPTIONS (using a filter)\n- Automatic CORS request handling (using a filter)\n- API declaration for Swagger UI ([go-restful-openapi](https://github.com/emicklei/go-restful-openapi))\n- Panic recovery to produce HTTP 500, customizable using RecoverHandler(...)\n- Route errors produce HTTP 404/405/406/415 errors, customizable using ServiceErrorHandler(...)\n- Configurable (trace) logging\n- Customizable gzip/deflate readers and writers using CompressorProvider registration\n- Inject your own http.Handler using the `HttpMiddlewareHandlerToFilter` function\n- Added `SetPathTokenCacheEnabled` and `SetCustomVerbCacheEnabled` to disable regexp caching (default=true)\n\n## How to customize\nThere are several hooks to customize the behavior of the go-restful package.\n\n- Router algorithm\n- Panic recovery\n- JSON decoder\n- Trace logging\n- Compression\n- Encoders for other serializers\n- Use the package variable `TrimRightSlashEnabled` (default true) to control the behavior of matching routes that end with a slash `/`\n\n## Resources\n\n- [Example programs](./examples)\n- [Example posted on blog](http://ernestmicklei.com/2012/11/go-restful-first-working-example/)\n- [Design explained on blog](http://ernestmicklei.com/2012/11/go-restful-api-design/)\n- [sourcegraph](https://sourcegraph.com/github.com/emicklei/go-restful)\n- [showcase: Zazkia - tcp proxy for testing resiliency](https://github.com/emicklei/zazkia)\n- [showcase: Mora - MongoDB REST Api server](https://github.com/emicklei/mora)\n\nType ```git shortlog -s``` for a full list of contributors.\n\n© 2012 - 2023, http://ernestmicklei.com. MIT License. Contributions are welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femicklei%2Fgo-restful","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femicklei%2Fgo-restful","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femicklei%2Fgo-restful/lists"}