Apimock
A lightweight solution in golang for API mock and automatic generation of API documentation / 一种适用于Go语言的接口Mock和接口文档自动生成的轻量级方案
Install / Use
/learn @WGrape/ApimockREADME
apimock
A lightweight solution in golang for API mock and automatic generation of API documentation / 一种适用于Go语言的接口Mock和接口文档自动生成的轻量级方案
一、背景介绍
在《关于接口文档高效治理方案的研究和思考》 这篇博客中,已经深入探讨过关于接口文档的现状、问题和解决方案。由于不同团队面临的问题不同,对接口文档的管理方式也不尽相同
本项目也是基于团队规模不同的观点考虑,提出了一种适用于Go语言的接口Mock和接口文档自动生成的轻量级方案,关于此方案的全面了解请参考文章《基于数据Mock的接口治理方案设计与实现》
二、快速安装
1、go get
go get github.com/WGrape/apimock@latest
2、go mod
module XXX
go 1.16
require (
github.com/WGrape/apimock latest
)
三、如何使用
使用请参考文章《基于数据Mock的接口治理方案设计与实现》
1、多语言
如在/mock/mock_zh.go和/mock/mock_en.go文件中分别定义了中文和英文两个版本的apiMock结构。这样当需要不同语言文档时,都可以快速支持。
2、接口文档/接口Mock/假接口
通过在/mock/mock.go文件中定义apiMock结构,不但可以实现接口文档生成,还可以实现接口Mock,和假接口的效果。高效提升了前后端开发的效率。
四、完整示例
关于详细的使用示例请参考 example ,其中的 apidoc.md 文件即为 apimock 工具自动生成的接口文档。
Related Skills
node-connect
354.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
354.2kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
frontend-design
112.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
