add_swagger_documentation的一些参数说明

2018-10-29  本文已影响0人  biubiudog

add_swagger_documentation 通过hash设置一些可选的配置:


1.host和base_path, 接受lambda或者proc,

   host可以设置明确的host,默认的话会从request请求中获取

   base_path:默认的话会从request请求中获取

2.mount_path:这个路径是api被加载的位置,默认是/swagger_doc

3.add_base_path:添加base_path到记录的路径(documentation),默认是false

4.add_version:将version键添加到记录的路径,默认是true

5.doc_version:在info中指定文档的版本,默认为'0.0.1'

6.endpoint_auth_wrapper:指定用于保护断点的中间键,值为某个api

7.hide_documentation_path: 是否隐藏记录的路径,默认:true

8.tags:要记录的tag列表,默认情况下会根据根据route名称自动的生成tags eg:[{name:'', description: ''}]

9.info: hash合并到json文档中  eg:{name: '', des: '', age: ''}

10.array_use_braces: 设置必须为true,为了params定义为array类型的可以按照顺序正确提交每个参数

11.api_documentation:自定义Swagger api路由文档,通常包含一个desc字段。默认描述是:"Swagger compatible API description"

上一篇下一篇

猜你喜欢

热点阅读