{"id":17953777,"url":"https://github.com/wzshiming/gen","last_synced_at":"2025-08-24T03:33:45.774Z","repository":{"id":37643118,"uuid":"138471634","full_name":"wzshiming/gen","owner":"wzshiming","description":"Gen generates efficient web routing source code and documentation from annotations","archived":false,"fork":false,"pushed_at":"2021-12-13T05:35:26.000Z","size":12099,"stargazers_count":50,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-08T01:42:22.085Z","etag":null,"topics":["generate","metaprogramming","microservice","no-framework","openapi","openapi3","restful","swagger"],"latest_commit_sha":null,"homepage":"https://github.com/wzshiming/gen","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/wzshiming.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}},"created_at":"2018-06-24T10:07:22.000Z","updated_at":"2024-11-15T22:55:13.000Z","dependencies_parsed_at":"2022-09-26T17:50:36.611Z","dependency_job_id":null,"html_url":"https://github.com/wzshiming/gen","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/wzshiming/gen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wzshiming%2Fgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wzshiming%2Fgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wzshiming%2Fgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wzshiming%2Fgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wzshiming","download_url":"https://codeload.github.com/wzshiming/gen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wzshiming%2Fgen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271785953,"owners_count":24820573,"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-08-24T02:00:11.135Z","response_time":111,"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":["generate","metaprogramming","microservice","no-framework","openapi","openapi3","restful","swagger"],"created_at":"2024-10-29T10:07:04.612Z","updated_at":"2025-08-24T03:33:45.752Z","avatar_url":"https://github.com/wzshiming.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gen - Tools for generating source code for microservices\n\nJust write normal functions, and Gen generates efficient routing source code and documentation for it\nBecause the source code is generated, none of this affects runtime performance  \nThe differences caused by each change in the tool are shown directly in the generated source code  \ngenerating clients is also supported  \n\n[![Build Status](https://travis-ci.org/wzshiming/gen.svg?branch=master)](https://travis-ci.org/wzshiming/gen)\n[![Go Report Card](https://goreportcard.com/badge/github.com/wzshiming/gen)](https://goreportcard.com/report/github.com/wzshiming/gen)\n[![GitHub license](https://img.shields.io/github/license/wzshiming/gen.svg)](https://github.com/wzshiming/gen/blob/master/LICENSE)\n\n- [English](https://github.com/wzshiming/gen/blob/master/README.md)\n- [简体中文](https://github.com/wzshiming/gen/blob/master/README_cn.md)\n\n## Examples\n\n'#' is the annotation, the annotation is the golang tag syntax, the only difference here is '#' wraps not '`'.\n\n``` golang\n// ItemService #path:\"/item/\"#\ntype ItemService struct {}\n\n// Create a Item #route:\"POST /\"#\nfunc (s *ItemService) Create(item *Item) (err error) {}\n\n// Update the Item #route:\"PUT /{item_id}\"#\nfunc (s *ItemService) Update(itemID int /* #name:\"item_id\"# */, item *Item) (err error) {}\n\n// Delete the Item #route:\"DELETE /{item_id}\"#\nfunc (s *ItemService) Delete(itemID int /* #name:\"item_id\"# */) (err error) {}\n\n// Get the Item #route:\"GET /{item_id}\"#\nfunc (s *ItemService) Get(itemID int /* #name:\"item_id\"# */) (item *ItemWithID, err error) {}\n\n// List of the Item #route:\"GET /\"#\nfunc (s *ItemService) List(offset, limit int) (items []*ItemWithID, err error) {}\n```\n\n1. Install gen tool `go get -v github.com/wzshiming/gen/cmd/gen`\n2. Add gen tool to $PATH\n3. Start it `gen run github.com/wzshiming/gen-examples/service/...`\n4. Open [http://127.0.0.1:8080/swagger/?url=./openapi.json#](http://127.0.0.1:8080/swagger/?url=./openapi.json#) with your browser\n\n[Examples](https://github.com/wzshiming/gen-examples/)  \n\nOr try to quickly build services from scratch\n\n1. Make a directory `mkdir -p $(go env GOPATH)/src/gentest`\n2. Change directory `cd $(go env GOPATH)/src/gentest/`\n3. Define models\n``` shell\ncat \u003e models.go \u003c\u003cEOF\npackage gentest\ntype Gentest struct {\n    Name string \\`json:\"name\"\\`\n    Age  int    \\`json:\"age\"\\`\n}\nEOF\n```\n4. Generated from CRUD template `gen crud -t mock -n Gentest`\n5. Start it `GO111MODULE=off gen run gentest`\n\n## Supported\n\n- [X] Generate documentation\n  - [X] [OpenAPI 3](https://github.com/OAI/OpenAPI-Style-Guide)\n  - [X] [SwaggerUI](https://github.com/swagger-api/swagger-ui)\n  - [X] [ReDoc](https://github.com/Rebilly/ReDoc)\n- [X] RESTful\n  - [X] Generate Go router\n    - [X] Security\n      - [X] apiKey\n      - [X] http\n        - [X] basic\n        - [ ] bearer\n      - [ ] oauth2\n      - [ ] openIdConnet\n    - [X] Content\n      - [X] Query\n      - [X] Path\n      - [X] Header\n      - [X] Cookie\n      - [X] Body\n        - [X] JSON\n        - [ ] XML\n        - [ ] Formdata\n          - [X] File\n          - [ ] Value\n        - [ ] URLEncode\n  - [X] Generate Go client\n    - [X] Security\n      - [X] apiKey\n      - [X] http\n        - [X] basic\n        - [X] bearer\n      - [ ] oauth2\n      - [ ] openIdConnet\n    - [X] Content\n      - [X] Query\n      - [X] Path\n      - [X] Header\n      - [X] Cookie\n      - [X] Body\n        - [X] JSON\n        - [X] XML\n        - [X] Formdata\n          - [X] File\n          - [X] Value\n        - [ ] URLEncode\n  - Other Client\n    - [OpenAPITools/openapi-generator](https://github.com/OpenAPITools/openapi-generator)\n    - [swagger-api/swagger-js](https://github.com/swagger-api/swagger-js)\n    - [swagger-api/swagger-codegen](https://github.com/swagger-api/swagger-codegen/tree/3.0.0)\n- [ ] gRPC \u0026 Proto3\n\n## License\n\nPouch is licensed under the MIT License. See [LICENSE](https://github.com/wzshiming/gen/blob/master/LICENSE) for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwzshiming%2Fgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwzshiming%2Fgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwzshiming%2Fgen/lists"}