webman/config/plugin/hg/apidoc/app.php

97 lines
3.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
return [
'enable' => true,
'apidoc' => [
// (选配)文档标题,显示在左上角与首页
'title' => 'Apidoc',
// (选配)文档描述,显示在首页
'desc' => '',
// (必须)设置文档的应用/版本
'apps' => [
[
// (必须)标题
'title'=>'Api接口',
// (必须)控制器目录地址
'path'=>'app\controller',
// 必须唯一的key
'key'=>'api',
]
],
// (必须)指定通用注释定义的文件地址
'definitions' => "app\common\controller\Definitions",
// 必须自动生成url规则当接口不添加@Apidoc\Url ("xxx")注解时,使用以下规则自动生成
'auto_url' => [
// 字母规则lcfirst=首字母小写ucfirst=首字母大写;
'letter_rule' => "lcfirst",
// url前缀
'prefix'=>"",
],
// (选配)是否自动注册路由
'auto_register_routes'=>false,
// (必须)缓存配置
'cache' => [
// 是否开启缓存
'enable' => false,
],
// (必须)权限认证配置
'auth' => [
// 是否启用密码验证
'enable' => false,
// 全局访问密码
'password' => "123456",
// 密码加密盐
'secret_key' => "apidoc#hg_code",
// 授权访问后的有效期
'expire' => 24*60*60
],
// 全局参数
'params'=>[
// 选配全局的请求Header
'header'=>[
// name=字段名type=字段类型require=是否必须default=默认值desc=字段描述
['name'=>'Authorization','type'=>'string','require'=>true,'desc'=>'身份令牌Token'],
],
// 选配全局的请求Query
'query'=>[
// 同上 header
],
// 选配全局的请求Body
'body'=>[
// 同上 header
],
],
// 全局响应体
'responses'=>[
// 成功响应体
'success'=>[
['name'=>'code','desc'=>'业务代码','type'=>'int','require'=>1],
['name'=>'message','desc'=>'业务信息','type'=>'string','require'=>1],
//参数同上 headersmain=true来指定接口Returned参数挂载节点
['name'=>'data','desc'=>'业务数据','main'=>true,'type'=>'object','require'=>1],
],
// 异常响应体
'error'=>[
['name'=>'code','desc'=>'业务代码','type'=>'int','require'=>1,'md'=>'/docs/HttpError.md'],
['name'=>'message','desc'=>'业务信息','type'=>'string','require'=>1],
]
],
//(选配)默认作者
'default_author'=>'',
//(选配)默认请求类型
'default_method'=>'GET',
//选配Apidoc允许跨域访问
'allowCrossDomain'=>false,
/**
* (选配)解析时忽略带@注解的关键词,当注解中存在带@字符并且非Apidoc注解如 @key test此时Apidoc页面报类似以下错误时:
* [Semantical Error] The annotation "@key" in method xxx() was never imported. Did you maybe forget to add a "use" statement for this annotation?
*/
'ignored_annitation'=>[],
// (选配)数据库配置
'database'=>[],
// 选配Markdown文档
'docs' => [],
// (选配)接口生成器配置 注意:是一个二维数组
'generator' =>[]
]
];