{"id":15566873,"url":"https://github.com/wgrape/apimock","last_synced_at":"2025-04-23T23:47:39.861Z","repository":{"id":52185897,"uuid":"520823065","full_name":"WGrape/apimock","owner":"WGrape","description":"A lightweight solution in golang for API mock and automatic generation of API documentation / 一种适用于Go语言的接口Mock和接口文档自动生成的轻量级方案","archived":false,"fork":false,"pushed_at":"2022-09-15T14:22:07.000Z","size":19,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T04:51:12.597Z","etag":null,"topics":["apidoc","apidoc-generator","go","golang","mock"],"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/WGrape.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-03T09:48:35.000Z","updated_at":"2024-03-07T10:05:53.000Z","dependencies_parsed_at":"2023-01-18T09:00:59.886Z","dependency_job_id":null,"html_url":"https://github.com/WGrape/apimock","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WGrape%2Fapimock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WGrape%2Fapimock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WGrape%2Fapimock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WGrape%2Fapimock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WGrape","download_url":"https://codeload.github.com/WGrape/apimock/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250535083,"owners_count":21446505,"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","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":["apidoc","apidoc-generator","go","golang","mock"],"created_at":"2024-10-02T17:08:00.714Z","updated_at":"2025-04-23T23:47:39.809Z","avatar_url":"https://github.com/WGrape.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# apimock\nA lightweight solution in golang for API mock and automatic generation of API documentation / 一种适用于Go语言的接口Mock和接口文档自动生成的轻量级方案\n\n## 一、背景介绍\n在[《关于接口文档高效治理方案的研究和思考》](https://github.com/WGrape/Blog/issues/229) 这篇博客中，已经深入探讨过关于接口文档的现状、问题和解决方案。由于不同团队面临的问题不同，对接口文档的管理方式也不尽相同\n\n本项目也是基于团队规模不同的观点考虑，提出了一种适用于Go语言的接口Mock和接口文档自动生成的轻量级方案，关于此方案的全面了解请参考文章[《基于数据Mock的接口治理方案设计与实现》](https://github.com/WGrape/Blog/issues/233)\n\n## 二、快速安装\n\n### 1、go get\n\n```\ngo get github.com/WGrape/apimock@latest\n```\n\n### 2、go mod\n\n```\nmodule XXX\n\ngo 1.16\n\nrequire (\n    github.com/WGrape/apimock latest\n)\n```\n\n## 三、如何使用\n使用请参考文章[《基于数据Mock的接口治理方案设计与实现》](https://github.com/WGrape/Blog/issues/233)\n\n### 1、多语言\n\n如在```/mock/mock_zh.go```和```/mock/mock_en.go```文件中分别定义了中文和英文两个版本的```apiMock```结构。这样当需要不同语言文档时，都可以快速支持。\n\n### 2、接口文档/接口Mock/假接口\n\n通过在```/mock/mock.go```文件中定义```apiMock```结构，不但可以实现接口文档生成，还可以实现接口Mock，和假接口的效果。高效提升了前后端开发的效率。\n\n## 四、完整示例\n关于详细的使用示例请参考 [example](./example) ，其中的 [apidoc.md](./example/apidoc.md) 文件即为 apimock 工具自动生成的接口文档。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwgrape%2Fapimock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwgrape%2Fapimock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwgrape%2Fapimock/lists"}