api_open_sdk

module
v0.0.0-...-a9153d3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2024 License: MIT

README

api_open_sdk 杭电助手自用 sdk

Goproxy.cn buf lint

前置步骤

//安装 编译所需的插件
//包括 buf protoc-gen-grpc-gateway protoc-gen-openapiv2 protoc-gen-go-grpc protoc-gen-go
//在 tools.go 中控制 要安装的插件列表,使用 go module 管理插件版本
make install-tools

依赖

开发流程

  1. 修改 proto 文件
  2. 运行 buf generate
  3. 开启 swagger-ui 实时预览

预览 swagger 效果 (多数情况下没必要预览) (感觉还有更简单的)

公开文档

https://github.com/hduhelp/api/config.json 中添加对应 OpenAPI 文件,提交后会自动拉取api_open_sdk最新文档

可在 https://hduhelp.github.io/api/ 页面查看接口文档

  1. 安装 swagger-ui
# 新建目录
git clone https://github.com/swagger-api/swagger-ui.git
cd swagger-ui
npm install
npm run dev
  1. 安装 http-server
npm install --global http-server
# 切回 api_open_sdk 根目录
cd docs/swagger-ui
http-server --cors
  1. 访问 swagger-ui 访问 http://localhost:3200/
    在地址栏内输入 json 的相对路径,如: http://localhost:8080/campusapis/staff/v1/freshman.swagger.json 点击 Explore 按钮,即可看到 swagger 文档

  2. 每次改动 proto 后需要重新运行 buf generate,并且「清空缓存并进行硬刷新」网页

Code Lint

接口注释

  • 有效:rpc 方法前,Response message 前,message内部字段前
  • 无效(不会显示到 swagger 中):Request message 前

Directories

Path Synopsis
aggregatingapis
infostream/v1
Package infostreamv1 is a reverse proxy.
Package infostreamv1 is a reverse proxy.
time/v1
Package timev1 is a reverse proxy.
Package timev1 is a reverse proxy.
aliyun
sls
api
backup
Package backup is a reverse proxy.
Package backup is a reverse proxy.
card/v1
Package cardv1 is a reverse proxy.
Package cardv1 is a reverse proxy.
gate/v1
Package gatev1 is a reverse proxy.
Package gatev1 is a reverse proxy.
health/v1
Package healthv1 is a reverse proxy.
Package healthv1 is a reverse proxy.
library/v1
Package libraryv1 is a reverse proxy.
Package libraryv1 is a reverse proxy.
needy/v1
Package needyv1 is a reverse proxy.
Package needyv1 is a reverse proxy.
schoolTime/v1
Package schoolTimev1 is a reverse proxy.
Package schoolTimev1 is a reverse proxy.
staff/v1
Package staffv1 is a reverse proxy.
Package staffv1 is a reverse proxy.
teaching/v1
Package teachingv1 is a reverse proxy.
Package teachingv1 is a reverse proxy.
third/v1
Package thirdv1 is a reverse proxy.
Package thirdv1 is a reverse proxy.
dingtalk/v1
Package dingtalkv1 is a reverse proxy.
Package dingtalkv1 is a reverse proxy.
faq/v1
Package faqv1 is a reverse proxy.
Package faqv1 is a reverse proxy.
wiki/v1
Package wikiv1 is a reverse proxy.
Package wikiv1 is a reverse proxy.
gatewayapis
auth/v1
Package authv1 is a reverse proxy.
Package authv1 is a reverse proxy.
server/v1
Package serverv1 is a reverse proxy.
Package serverv1 is a reverse proxy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL