Skip to content

Commit 3021cfa

Browse files
committed
Update docs
1 parent 2f33e85 commit 3021cfa

File tree

10 files changed

+133
-379
lines changed

10 files changed

+133
-379
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
</a>
2323
</p>
2424

25-
> This branch is in development preview state.
26-
2725
**Flask OpenAPI3** is a web API framework based on **Flask**. It uses **Pydantic** to verify data and automatic
2826
generation of interaction documentation.
2927

docs/Quickstart.zh.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ if __name__ == '__main__':
9090

9191
## 嵌套 APIBlueprint
9292

93-
*v2.0.0 新增*
94-
9593
允许一个 **API Blueprint** 被另一个 **API Blueprint** 注册。
9694

9795
更多信息请查看 [Flask Nesting Blueprints](https://flask.palletsprojects.com/en/latest/blueprints/#nesting-blueprints)
@@ -128,8 +126,6 @@ if __name__ == '__main__':
128126

129127
## APIView
130128

131-
*v2.2.0 新增*
132-
133129
[基于类的 API 视图](./Reference/APIView.md), 点击[这里](https://github.com/luolingchun/flask-openapi3/blob/APIView/examples/api_view_demo.py) 查看完整示例:
134130

135131
```python
@@ -150,8 +146,6 @@ class BookListAPIView:
150146

151147
## 异步 API
152148

153-
*v2.2.2 新增*
154-
155149
在定义函数时使用 `async`。 更多信息参考 [Using async and await — Flask Documentation](https://flask.palletsprojects.com/en/latest/async-await/)
156150

157151
!!! info

docs/Usage/Configuration.md

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Flask supports many [configurations](https://flask.palletsprojects.com/en/latest/config/), and there are also some
22
configurations in this library that can be used.
33

4+
## SWAGGER_HTML_STRING
5+
6+
You can customize the custom behavior of this template.
7+
8+
[The default `SWAGGER_HTML_STRING` is here](https://github.com/luolingchun/flask-openapi3-plugins/blob/master/flask-openapi3-swagger/flask_openapi3_swagger/templates/__init__.py).
9+
410
## SWAGGER_CONFIG
511

612
You can change the default behavior of the Swagger UI.
@@ -16,8 +22,7 @@ app.config["SWAGGER_CONFIG"] = {
1622
}
1723
```
1824

19-
Here are more configuration options for Swagger UI, which you can
20-
find [here](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md).
25+
[More configuration options for Swagger UI](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md).
2126

2227
## OAUTH_CONFIG
2328

@@ -31,5 +36,64 @@ app = OpenAPI(__name__)
3136
app.config["OAUTH_CONFIG"] = {"clientId": "xxx", "clientSecret": "xxx"}
3237
```
3338

34-
Here are more configuration options for OAuth 2.0 configuration, which you can
35-
find [here](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/oauth2.md).
39+
[More configuration options for Swagger UI](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/oauth2.md).
40+
41+
## SCALAR_HTML_STRING
42+
43+
You can customize the custom behavior of this template.
44+
45+
[The default `SCALAR_HTML_STRING` is here](https://github.com/luolingchun/flask-openapi3-plugins/blob/master/flask-openapi3-scalar/flask_openapi3_scalar/templates/__init__.py).
46+
47+
## SCALAR_CONFIG
48+
49+
You can change the default behavior of the Scalar UI.
50+
51+
[More configuration options for Swagger UI](https://github.com/scalar/scalar/blob/main/documentation/configuration.md).
52+
53+
## REDOC_HTML_STRING
54+
You can customize the custom behavior of this template.
55+
56+
[The default `REDOC_HTML_STRING` is here](https://github.com/luolingchun/flask-openapi3-plugins/blob/master/flask-openapi3-redoc/flask_openapi3_redoc/templates/__init__.py).
57+
58+
## REDOC_CONFIG
59+
60+
You can change the default behavior of the Redoc UI.
61+
62+
[More configuration options for Redoc UI](https://github.com/Redocly/redoc/blob/main/docs/config.md).
63+
64+
## RAPIDOC_HTML_STRING
65+
66+
You can customize the custom behavior of this template.
67+
68+
[The default `RAPIDOC_HTML_STRING` is here](https://github.com/luolingchun/flask-openapi3-plugins/blob/master/flask-openapi3-rapidoc/flask_openapi3_rapidoc/templates/__init__.py).
69+
70+
## RAPIDOC_CONFIG
71+
72+
You can change the default behavior of the Rapidoc UI.
73+
74+
[More configuration options for Rapidoc UI](https://rapidocweb.com/examples.html).
75+
76+
## RAPIPDF_HTML_STRING
77+
78+
You can customize the custom behavior of this template.
79+
80+
[The default `RAPIPDF_HTML_STRING` is here](https://github.com/luolingchun/flask-openapi3-plugins/blob/master/flask-openapi3-rapipdf/flask_openapi3_rapipdf/templates/__init__.py).
81+
82+
## RAPIPDF_CONFIG
83+
84+
You can change the default behavior of the Rapipdf UI.
85+
86+
[More configuration options for Rapipdf UI](https://mrin9.github.io/RapiPdf/).
87+
88+
## ELEMENTS_HTML_STRING
89+
90+
You can customize the custom behavior of this template.
91+
92+
[The default `ELEMENTS_HTML_STRING` is here](https://github.com/luolingchun/flask-openapi3-plugins/blob/master/flask-openapi3-elements/flask_openapi3_elements/templates/__init__.py).
93+
94+
95+
## ELEMENTS_CONFIG
96+
97+
You can change the default behavior of the Elements UI.
98+
99+
[More configuration options for Rapipdf UI](https://github.com/stoplightio/elements/blob/main/docs/getting-started/elements/elements-options.md).

docs/Usage/Specification.md

Lines changed: 2 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ Usage: flask openapi [OPTIONS]
3030
3131
Options:
3232
-o, --output PATH The output file path.
33-
-f, --format [json|yaml|markdown]
33+
-f, --format [json|yaml]
3434
The output file format.
3535
-i, --indent INTEGER The indentation for JSON dumps.
36-
-a, --ensure_ascii Ensure ASCII characters or not. Defaults to
37-
False.
3836
--help Show this message and exit.
3937
4038
```
@@ -70,7 +68,7 @@ if __name__ == '__main__':
7068

7169
run it, and go to http://127.0.0.1:5000/openapi, you will see the documentation.
7270

73-
![openapi](../images/openapi.png)
71+
![openapi](../images/openapi-all.png)
7472
![image-20210525160157057](../assets/image-20210525160157057.png)
7573

7674
## security_schemes
@@ -139,67 +137,6 @@ result:
139137

140138
![image-20210525165350520](../assets/image-20210525165350520.png)
141139

142-
143-
## oauth_config
144-
145-
!!! Deprecated-Warning warning
146-
147-
The `oauth_config` is deprecated in v4.x, use `app.config['OAUTH_CONFIG']` instead.
148-
149-
```python
150-
from flask_openapi3 import OpenAPI
151-
152-
app = OpenAPI(__name__)
153-
154-
app.config["OAUTH_CONFIG"] = {"clientId": "xxx", "clientSecret": "xxx"}
155-
```
156-
157-
You can pass `oauth_config` when initializing `OpenAPI`:
158-
159-
```python
160-
from flask_openapi3 import OpenAPI, OAuthConfig
161-
from flask_openapi3 import Info
162-
163-
info = Info(title='oauth API', version='1.0.0')
164-
165-
oauth_config = OAuthConfig(
166-
clientId="xxx",
167-
clientSecret="xxx"
168-
)
169-
170-
oauth2 = {
171-
"type": "oauth2",
172-
"flows": {
173-
"implicit": {
174-
"authorizationUrl": "https://example.com/api/oauth/dialog",
175-
"scopes": {
176-
"write:pets": "modify pets in your account",
177-
"read:pets": "read your pets"
178-
}
179-
}
180-
}
181-
}
182-
183-
security_schemes = {"oauth2": oauth2}
184-
185-
app = OpenAPI(__name__, info=info, oauth_config=oauth_config, security_schemes=security_schemes)
186-
187-
security = [
188-
{"oauth2": ["write:pets", "read:pets"]}
189-
]
190-
191-
192-
@app.get("/", security=security)
193-
def oauth():
194-
return "oauth"
195-
196-
197-
if __name__ == '__main__':
198-
app.run(debug=True)
199-
```
200-
201-
Here's more information about [OAuth 2.0 configuration](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/oauth2.md)
202-
203140
## responses
204141

205142
You can add `responses` for each API under the `app` wrapper.
@@ -267,87 +204,6 @@ def get_book():
267204
...
268205
```
269206

270-
## doc_expansion
271-
272-
!!! Deprecated-Warning warning
273-
274-
The `doc_expansion` is deprecated in v4.x, use `app.config['SWAGGER_CONFIG']` instead.
275-
276-
```python
277-
from flask_openapi3 import OpenAPI
278-
279-
app = OpenAPI(__name__)
280-
281-
app.config["SWAGGER_CONFIG"] = {
282-
"docExpansion": "none",
283-
"validatorUrl": "https://www.b.com"
284-
}
285-
```
286-
287-
Just for Swagger UI.
288-
289-
String=["list", "full", "none"].
290-
291-
Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), full' (expands the tags and operations) or 'none' (expands nothing).
292-
293-
More information to see [Configuration](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md).
294-
295-
```python
296-
app = OpenAPI(__name__, info=info, doc_expansion='full')
297-
```
298-
299-
## swagger_config
300-
301-
!!! Deprecated-Warning warning
302-
303-
The `doc_expansion` is deprecated in v4.x, use `app.config['SWAGGER_CONFIG']` instead.
304-
305-
```python
306-
from flask_openapi3 import OpenAPI
307-
308-
app = OpenAPI(__name__)
309-
310-
app.config["SWAGGER_CONFIG"] = {
311-
"docExpansion": "none",
312-
"validatorUrl": "https://www.b.com"
313-
}
314-
```
315-
316-
Swagger supports many configuration items.
317-
For more information on Swagger Configuration,
318-
please refer to [Swagger Configuration](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md).
319-
320-
```python
321-
app = OpenAPI(
322-
__name__,
323-
swagger_config={
324-
"docExpansion": "none",
325-
"validatorUrl": "https://www.b.com"
326-
}
327-
)
328-
```
329-
330-
## Interactive documentation
331-
332-
!!! Deprecated-Warning warning
333-
334-
`api_doc_url` will be renamed to `doc_url` in v4.x, and `swagger_url`, `redoc_url`, `rapidoc_url` will be removed.
335-
336-
337-
**Flask OpenAPI3** provides support for the following Interactive documentation:
338-
339-
- [Swagger](https://github.com/swagger-api/swagger-ui)
340-
- [Redoc](https://github.com/Redocly/redoc)
341-
- [RapiDoc](https://github.com/rapi-doc/RapiDoc)
342-
343-
The following are the default values of these configurations. Of course, you can change them:
344-
345-
- doc_prefix = "/openapi"
346-
- api_doc_url = "/openapi.json"
347-
- swagger_url= "/swagger"
348-
- redoc_url = "/redoc"
349-
- rapidoc_url = "/rapidoc"
350-
351207
## servers
352208

353209
An array of Server Objects, which provide connectivity information to a target server. If the server's property is not provided, or is an empty array, the default value would be a Server Object with an url value of /.

0 commit comments

Comments
 (0)