SPhinX extension for documenting swagger 2.0 APIS
sphinxcontrib-swaggerdoc的Python项目详细描述
Sphinx扩展,用于记录Swagger 2.0 API
pip install sphinxcontrib-swaggerdoc
用法
在conf.py
中包含扩展名extensions=['sphinxcontrib.swaggerdoc']
添加指向远程扩展API文档的指令
..swaggerv2doc:: URL/swagger.json
或本地文件
..swaggerv2doc:: file:///PATH/swagger.json
例如
..swaggerv2doc:: http://petstore.swagger.io/v2/swagger.json
如果swagger描述包含多个标记,则可以选择一个子集 用于生成文档。例如,仅以下指令 为标签pet中包含的方法生成文档,并 store。
..swaggerv2doc:: http://petstore.swagger.io/v2/swagger.json pet store
注
swagger 1.0的旧指令仍然可用。例如,
..swaggerdoc:: http://petstore.swagger.wordnik.com/api/api-docs/pet ..swaggerdoc:: http://petstore.swagger.wordnik.com/api/api-docs/user ..swaggerdoc:: http://petstore.swagger.wordnik.com/api/api-docs/store