Giter VIP home page Giter VIP logo

api_open_sdk's Introduction

api_open_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 效果 (多数情况下没必要预览) (感觉还有更简单的)

  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,并且「清空缓存并进行硬刷新」网页

接口注释

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

api_open_sdk's People

Contributors

fdkevin0 avatar aflybird0 avatar setcy avatar asjdf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.