博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用apidocJs快速生成在线文档
阅读量:7240 次
发布时间:2019-06-29

本文共 2329 字,大约阅读时间需要 7 分钟。

https://blog.csdn.net/xialei199023/article/details/63251482

 

https://blog.csdn.net/qq_16142851/article/details/78319768?locationNum=1&fps=1

 

对比下面的两个例子,对apidoc的文档参数就有个基本认识了

例子 01

/*** @api {get} index.php?i=  测试一* @apiGroup test* @apiVersion 0.0.1 * @apiDescription 这是第一个测试 * @apiParam {String} token 登录token * @apiParamExample 请求样例 * /index.php?i=8888 * @apiSuccess {int} type 类型 0:上行 1:下行 * @apiExample 请求成功数据 * { * "status": "1", * "data": { * "first": 1, * "last": 3, * }, * "msg": "操作成功" * } * @apiExample {json} 失败返回样例: * { "code":"0","msg":"修改成功"} */

例子02

/**    * @api {POST} /test/:id 测试二    * @apiGroup test    * @apiVersion 0.0.1    * @apiDescription 这是第二个测试 * @apiParam {String} name 名字 * @apiParam {String} [phone] 手机 * @apiSuccess (Success) {String} msg 信息 * @apiSuccess (Success) {int} code 0 代表无错误 1代表有错误 * @apiError (Error) {String} msg 信息 * @apiError (Error) {String} m 信息 * @apiParamExample 请求样例 * /index.php?i=8888 * @apiSuccessExample {json} 返回样例 * {"code":"0","msg":"修改成功"} * @apiErrorExample {json} 失败返回样例 * {"code":"0","msg":"修改成功"} */

apidoc 文档参数详细说明

* @apiDeprecated [提示消息] //弃用标志 如果未指定[]里面内容{包括中括号},则下次不产生该接口,如果指定,则输出提示消息* @api {POST} /test/:id 测试二 //指定接收方式以及显示名称* @apiGroup //分组 * @apiVersion //版本 * @apiDescription //描述 * @apiParam {String} name 名字 // 参数类型 以及参数名称 没有中括号代表必选参数 * @apiParam {String} [phone] 手机 // 参数类型 以及参数名称 [phone] 代表可选参数 * @apiSuccess (Success) {String} msg 信息 //返回成功数据名称以及类型 * @apiError (Error) {String} msg 信息 //返回失败数据名称以及类型 * @apiParamExample 请求样例 //示例 * /index.php?i=8888 //例子 * @apiSuccessExample {json} 返回样例 // 返回成功数据以及指定返回数据格式 * { "code":"0","msg":"修改成功"} //指定json格式后可以不用格式化,apidoc 输出的时候会做做处理 * @apiErrorExample {json} 失败返回样例 // 返回失败数据以及指定返回数据格式 * { "code":"0","msg":"修改成功"}

tips

01: warn: Please create an apidoc.json configuration file.

检查你的项目下 有没有 apidoc.json  //没有则创建{  "name": "文档名称",  "version": "0.1.0", //版本号 "description": "apiDoc basic example", // 描述 "title": "Custom apiDoc browser title", // 头部 "url" : "http://192.168.197.135/" // 项目地址 "sampleUrl" : "http://192.168.197.135/" //接口默认发送的地址 }

02:warn: parser plugin ‘param’ not found in block: 1

具体问题没有找到 下面的是我的做法# rm -rf test/apidoc/*# apidoc -i test/ -o test/apidoc/-- 这样子就解决了!

03 :apidoc error: No files found. { Path: ‘/data/wwwroot’ }

应该是因为 nodejs版本太高 以及 npn版本太高的原因

转载于:https://www.cnblogs.com/mapu/p/9186282.html

你可能感兴趣的文章
React-Router看这里
查看>>
打造一个通用的 RecyclerView Adapter
查看>>
基于redis的秒杀
查看>>
js如何实现上拉加载更多...
查看>>
.Net Core Logger 实现log写入本地文件系统
查看>>
Java Servlet关键点详解
查看>>
深入分析luait反编译之luajit-decomp
查看>>
从头编写 asp.net core 2.0 web api 基础框架 (5) EF CRUD
查看>>
【我们一起写框架】MVVM的WPF框架(五)—完结篇
查看>>
学习ASP.NET Core Razor 编程系列十一——把新字段更新到数据库
查看>>
江山代有才人出 | 微软亚洲研究院建院二十周年
查看>>
Linux安装gitlab
查看>>
java源码-synchronized
查看>>
PostgreSQL 10.1 手册_部分 III. 服务器管理_第 21 章 数据库角色_21.2. 角色属性
查看>>
《刻意练习》读后感
查看>>
DataWorks V2.0 系列公开课
查看>>
使用 logstash, elasticsearch, kibana 搭建日志分析系统
查看>>
Android Q 将获得大量的隐私保护功能
查看>>
《恋恋笔记本》观后感
查看>>
Spring源码剖析6:Spring AOP概述
查看>>