Skip to content

Commit

Permalink
doc: global params
Browse files Browse the repository at this point in the history
  • Loading branch information
daodao97 committed Aug 29, 2021
1 parent f2c9f7b commit 25185fb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 19 deletions.
54 changes: 36 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,43 @@ return [
'schemes' => ['http'],
],
'templates' => [
// {template} 字面变量 替换 schema 内容
// // 默认 成功 返回
// 'success' => [
// "code|code" => '0',
// "result" => '{template}',
// "message|message" => 'Success',
// ],
// // 分页
// 'page' => [
// "code|code" => '0',
// "result" => [
// 'pageSize' => 10,
// 'total' => 1,
// 'totalPage' => 1,
// 'list' => '{template}'
// ],
// "message|message" => 'Success',
// ],
// {template} 字面变量 替换 schema 内容
// // 默认 成功 返回
// 'success' => [
// "code|code" => '0',
// "result" => '{template}',
// "message|message" => 'Success',
// ],
// // 分页
// 'page' => [
// "code|code" => '0',
// "result" => [
// 'pageSize' => 10,
// 'total' => 1,
// 'totalPage' => 1,
// 'list' => '{template}'
// ],
// "message|message" => 'Success',
//],
],
// golbal 节点 为全局性的 参数配置
// 跟注解相同, 支持 header, path, query, body, formData
// 子项为具体定义
// 模式一: [ key => rule ]
// 模式二: [ [key, rule, defautl, description] ]
'global' => [
// 'header' => [
// "x-token|验签" => "required|cb_token"
// ],
// 'query' => [
// [
// 'key' => 'xx|cc',
// 'rule' => 'required',
// 'default' => 'abc',
// 'description' => 'description'
// ]
// ]
]
];
```

Expand Down
2 changes: 1 addition & 1 deletion src/Swagger/SwaggerJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ public function putFile(string $file, string $content)
$pathInfo = pathinfo($file);
if (! empty($pathInfo['dirname'])) {
if (file_exists($pathInfo['dirname']) === false) {
if (mkdir($pathInfo['dirname'], 0777, true) && chmod($pathInfo['dirname'], 0777)) {
if (mkdir($pathInfo['dirname'], 0644, true) && chmod($pathInfo['dirname'], 0644)) {
return false;
}
}
Expand Down

0 comments on commit 25185fb

Please sign in to comment.