Skip to content

yishenggudou/sphinx-rest-api-doc

Repository files navigation

sphinxcontrib-sphinx-rest-api-doc

https://travis-ci.org/yishenggudou/sphinxcontrib-sphinx-rest-api-doc.svg?branch=master

a tools for sphinx gen doc from json api

Overview

Add a longer description here.

INSTALL

pip install sphinxcontrib-sphinx-rest-api-doc

Basic usage

.. rest: path_to_model.json

example in model file

 {
"title": "测试资源",
"desc": "测试测试测试",
"method": {
  "get": {
    "list": false,
    "path": "/api/xx/xx/xx",
    "params": {
      "id":"ddede"
    },
    "desc": "dwdwedewfeferferferferfewr",
    "headers": {
      "auth":"auth"
    },
    "codes": {
      "400":"de",
      "200":"2"
    }
  }
},
"model": {
  "id":"",
  "desc":"dede"
}
 }

CONFIG

in config.py

extensions += ['sphinxcontrib.SphinxRest',]
rest_api_source_root = os.path.join(PROJECT_DIR, "_static", "models")
rest_api_domain = "timger.com.cn"
rest_api_http_request_example_title = "Request Example"
rest_api_http_response_example_title = "Response Example"

Links