Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
abersheeran committed Apr 11, 2020
1 parent 5649c94 commit 47802dd
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/http/openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,30 @@ app.mount(

同样的,所有 Model 的 `__doc__` 也会被当作对应的描述安置在生成的文档中。

### Tags

OpenAPI 的 Tags 是一个有用的功能,在 Index 里,你可以通过如下方式来指定 URL 的 tags

```python
app.mount(
"/openapi",
OpenAPI(
"index.py example",
"just a example, power by index.py",
__version__,
tags={
"something": {
"description": "test over two tags in one path",
"paths": ["/about/", "/file", "/"],
},
"about": {"description": "about page", "paths": ["/about/", "/about/me"]},
"file": {"description": "get/upload file api", "paths": ["/file"]},
},
),
"asgi",
)
```

## 解析请求

一般来说,从 HTTP 请求中传递参数的位置有五个——`path``query``header``cookie``body`。但 Index 的设计中,并没有给路径参数(`path`)留下位置,故只有后四种可被 Index 处理。*(可以像使用 PHP 一样用 Nginx 把 query 参数转为 path 参数,但没必要)*
Expand Down

0 comments on commit 47802dd

Please sign in to comment.