免費開源API接口管理工具eoLinker更新版本,增加了識別代碼註釋生成文檔功能!

產品地址:https://www.eolinker.com
開源代碼:https://www.eolinker.com/#/os/download
在線生成代碼註釋工具:http://tool.eolinker.com/doc2code
註釋生成文檔腳本:https://github.com/eolinker/Code2Doc

eoLinker 提供了從代碼註釋直接生成接口文檔的功能,有效地將接口文檔與代碼實現了同步。本篇文章將詳細介紹如何通過eoLinkerPython腳本程序來生成文檔。

【必要條件】

eoLinker用戶帳戶

已經在線上版創建了一個項目

已經獲取項目的Project_Key以及Secret_Key

eoLinker註釋生成文檔腳本:https://github.com/eolinker/Code2Doc

如何獲取Project_Key以及Secret_Key

在項目概況頁面,點擊其他功能-自動生成文檔按鈕,會出現以下彈框,顯示相關的Project_Key以及Secret_Key

【環境要求】

目前代碼註釋生成文檔支持Python,需要安裝2.7以上版本的Python,並且開啓recodesrequests模塊。

【相關工具】

eoLinker自動生成文檔腳本:https://github.com/eolinker/Code2Doc

eoLinker在線生成代碼註釋工具:http://tool.eolinker.com/doc2code

【規範】

eoLinker擁有自己的文本標記語言(EOML),爲了減少輸入流程,請使用eoLinker提供的在線生成代碼註釋工具(http://tool.eolinker.com/doc2code)。

group[必填]API分組名稱

childGroup[選填],子分組名稱(歸屬於group之下)

status[必填],接口狀態,work(啓用)| maintain(維護)| abandoned(棄用)

protocol[必填],請求協議,http|https

method[必填],請求方式,post | get | put | delete | head | options | patch

path[必填]API地址

name[必填]API名稱

header[選填],請求頭部,內容使用{}包裹

name,頭部名稱

value,頭部參數值

parameter[選填],請求參數,內容使用{}包裹

name,參數名

type,參數類型,string | file | json | int | float | double | date | datetime | boolean | byte | short | long | array | object

required,是否必填,true(是)|false(否)

response[選填],返回參數,內容使用{}包裹

name,參數名

description,描述

type,參數類型,string | file | json | int | float | double | date | datetime | boolean | byte | short | long | array | object

required,是否一定返回,true(是)|false(否)

【例子一(使用/**/註解)】

/**

* group = "父分組";

* childGroup = "子分組";

* status = "work";

* protocol = "http";

* method = "POST";

* path = "www.baidu.com";

* name = "測試";

* header = {name="Accept-Charset",value="utf-8"};

* header = {name="Content-Type",value="application/xml"};

* parameter = {name = "userID", type = "string", description = "用戶ID", required = true};

* parameter = {name = "userName", type = "string", description = "用戶名稱", required = true};

* response = {name = "statusCode",description = "狀態碼", type = "string", required = true};

*/

【例子二(使用’’’或”””註解)】

”””

group = "父分組";

childGroup = "子分組"

status = "work";

protocol = "http";

method = "POST";

path = "www.baidu.com6";

name = "測試";

header = {name="Accept-Charset",value="utf-8"};

header = {name="Content-Type",value="application/xml"};

parameter = {name = "userID", type = "string", description = "用戶ID", required = true};

parameter = {name = "userName", type = "string", description = "用戶名稱", required = true};

response = {name = "statusCode",description = "狀態碼", type = "string", required = true};

”””

【配置文件】

project_key,項目key

secret_key,密碼key

file_path,讀取文件的目錄路徑,window系統請按照r"c:\test"或者"c:\\test"寫法寫

file_suffix,讀取文件的後綴名,比如phppyjava

exclude_file,排除文件名

user_nameeoLinker用戶賬號

user_password,用戶密碼

【配置文件例子】

project_key = 'uwiuryomx3asudhcami3y498cy7m2'

secret_key = '7962h4s83asd'

file_path = 'C:\\project\\code_upload'

file_suffix = 'java'

exclude_file = ['gitignore','config.php']

user_name = 'test'

user_password = '123456'

完成以上配置之後,運行eolinker.py腳本既可自動生成文檔,返回“成功”則自動生成成功,否則失敗。


eoLinker是一個免費開源的針對開發人員需求而設計的接口管理工具,通過簡單的操作來幫助開發者進行接口文檔管理、接口自動化測試、團隊協作、數據獲取、安全防禦監控等功能,降低企業的接口管理成本,提高項目的整體開發效率,支持自動化測試管理、權限管理、代碼生成、團隊協作,並且提供PC端產品以及瀏覽器增強插件,讓接口管理更加簡單。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章