Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
luolingchun committed Apr 1, 2023
1 parent 19a6f75 commit 103ef5c
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 34 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The key features are:

Python 3.7+

flask-openapi3 be dependent on the following libraries:
flask-openapi3 is dependent on the following libraries:

- [Flask](https://github.com/pallets/flask) for the web app.
- [Pydantic](https://github.com/pydantic/pydantic) for the data validation.
Expand Down Expand Up @@ -107,7 +107,7 @@ class BookQuery(BaseModel):
@app.get("/book", tags=[book_tag])
def get_book(query: BookQuery):
"""get books
get all books
to get all books
"""
return {
"code": 0,
Expand Down Expand Up @@ -164,7 +164,7 @@ class BookListAPIView:

@api_view.doc(summary="create book")
def post(self, body: BookBody):
"""description for create book"""
"""description for a created book"""
return body.json()


Expand Down
4 changes: 2 additions & 2 deletions docs/Example.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BookQuery(BaseModel):
@app.get('/book', tags=[book_tag])
def get_book(query: BookQuery):
"""get books
get all books
to get all books
"""
return {
"code": 0,
Expand Down Expand Up @@ -126,7 +126,7 @@ def get_book(path: BookPath):
@app.get('/book', doc_ui=True, deprecated=True)
def get_books(query: BookQuery):
"""get books
get all books
to get all books
"""
print(query)
return {
Expand Down
4 changes: 2 additions & 2 deletions docs/Quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class BookListAPIView:

@api_view.doc(summary="create book")
def post(self, body: BookBody):
"""description for create book"""
"""description for a created book"""
return body.json()
```

Expand All @@ -152,7 +152,7 @@ class BookListAPIView:

*New in v2.2.2*

Just use `async` when defining functions. More information go to [Using async and await — Flask Documentation](https://flask.palletsprojects.com/en/latest/async-await/).
Just use `async` when defining functions. More information goes to [Using async and await — Flask Documentation](https://flask.palletsprojects.com/en/latest/async-await/).

!!! info

Expand Down
8 changes: 4 additions & 4 deletions docs/Tutorial/Operation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## tag

You can also specify tag for apis, like this:
You can also specify tag for apis like this:

```python hl_lines="3 6"
from flask_openapi3 import Tag
Expand Down Expand Up @@ -36,7 +36,7 @@ def create_book(body: BookBody):

## summary and description

You need add docs to the view-func. The first line is the **summary**, and the rest is the **description**. like this:
You need to add docs to the view-func. The first line is the **summary**, and the rest is the **description**. Like this:

```python hl_lines="3 4 5 6"
@app.get('/book/<int:bid>', tags=[book_tag], responses={"200": BookResponse}, security=security)
Expand Down Expand Up @@ -92,7 +92,7 @@ def get_book(path: BookPath):

## operation_id

You can set `operation_id` for an api (operation) . The default is automatically.
You can set `operation_id` for an api (operation). The default is automatically.

```python hl_lines="6"
@app.get(
Expand Down Expand Up @@ -169,7 +169,7 @@ def create_book(body: BookForm):

*New in v1.0.0*

`deprecated`: mark as deprecated support. Default to not True.
`deprecated`: mark as deprecated support. default to not True.

```python
@app.get('/book', deprecated=True)
Expand Down
2 changes: 1 addition & 1 deletion docs/Tutorial/Response.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class BookResponse(BaseModel):

@app.get('/book/<int:bid>', tags=[book_tag], responses={"200": BookResponse})
def get_book(path: BookPath, query: BookBody):
"""get book
"""get a book
get book by id, age or author
"""
return {"code": 0, "message": "ok", "data": {}}
Expand Down
6 changes: 3 additions & 3 deletions docs/Tutorial/Specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Options:
**`flask-openapi3`** provide [Swagger UI](https://github.com/swagger-api/swagger-ui), [Redoc](https://github.com/Redocly/redoc) and [RapiDoc](https://github.com/rapi-doc/RapiDoc) interactive documentation.
Before that, you should know something about the [OpenAPI Specification](https://spec.openapis.org/oas/v3.0.3).

You must import **`Info`** from **`flask-openapi3`**, it needs some parameters: **`title`**, **`version`**... , more information see the [OpenAPI Specification Info Object](https://spec.openapis.org/oas/v3.0.3#info-object).
You must import **`Info`** from **`flask-openapi3`**, it needs some parameters: **`title`**, **`version`**... , more information sees the [OpenAPI Specification Info Object](https://spec.openapis.org/oas/v3.0.3#info-object).

```python hl_lines="4 5"
from flask_openapi3 import Info
Expand All @@ -70,7 +70,7 @@ run it, and go to http://127.0.0.1:5000/openapi, you will see the documentation.

Like [Info](#info), import **`HTTPBearer`** from **`flask_openapi3`**, more features see the [OpenAPI Specification Security Scheme Object](https://spec.openapis.org/oas/v3.0.3#security-scheme-object).

First, you need define the **security_schemes** and **security** variable:
First, you need to define the **security_schemes** and **security** variable:

```python
security_schemes = {"jwt": HTTPBearer(bearerFormat="JWT")}
Expand Down Expand Up @@ -240,7 +240,7 @@ app = OpenAPI(__name__, info=info, doc_expansion='full')

## Interactive documentation

**Flask OpenAPI3** provides support to the following Interactive documentation:
**Flask OpenAPI3** provides support for the following Interactive documentation:

- [Swagger](https://github.com/swagger-api/swagger-ui)
- [Redoc](https://github.com/Redocly/redoc)
Expand Down
4 changes: 2 additions & 2 deletions docs/index.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class BookQuery(BaseModel):
@app.get("/book", tags=[book_tag])
def get_book(query: BookQuery):
"""get books
get all books
to get all books
"""
return {
"code": 0,
Expand Down Expand Up @@ -162,7 +162,7 @@ class BookListAPIView:

@api_view.doc(summary="create book")
def post(self, body: BookBody):
"""description for create book"""
"""description for a created book"""
return body.json()


Expand Down
6 changes: 3 additions & 3 deletions flask_openapi3/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(
Based on Flask Blueprint
Arguments:
name: The name of the blueprint. Will be prepended to each endpoint name.
name: The name of the blueprint. It Will be prepared to each endpoint name.
import_name: The name of the blueprint package, usually
``__name__``. This helps locate the ``root_path`` for the blueprint.
abp_tags: APIBlueprint tags for every api
Expand Down Expand Up @@ -103,8 +103,8 @@ def _do_decorator(
:param responses: response model
:param extra_responses: extra response dict
:param security: security name
:param doc_ui: add openapi document UI(swagger and redoc). Defaults to True.
:param deprecated: mark as deprecated support. Default to not True.
:param doc_ui: adds openapi document UI(swagger and redoc). defaults to True.
:param deprecated: mark as deprecated support. default to not True.
:param operation_id: unique string used to identify the operation.
:param method: api method
:return:
Expand Down
4 changes: 2 additions & 2 deletions flask_openapi3/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(
swagger_url: The Swagger UI documentation. Defaults to `/swagger`.
redoc_url: The Redoc UI documentation. Defaults to `/redoc`.
rapidoc_url: The RapiDoc UI documentation. Defaults to `/rapidoc`.
ui_templates: Custom UI templates, which used to overwrite or add UI documents.
ui_templates: Custom UI templates, which are used to overwrite or add UI documents.
servers: An array of Server Objects, which provide connectivity information to a target server.
external_docs: Allows referencing an external resource for extended documentation.
See: https://spec.openapis.org/oas/v3.0.3#external-documentation-object
Expand Down Expand Up @@ -99,7 +99,7 @@ def __init__(

def _init_doc(self) -> None:
"""
Provide Swagger UI, Redoc and Rapidoc
Provide Swagger UI, Redoc, and Rapidoc
"""
_here = os.path.dirname(__file__)
template_folder = os.path.join(_here, "templates")
Expand Down
18 changes: 9 additions & 9 deletions flask_openapi3/scaffold.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def get(
operation_id: Unique string used to identify the operation.
extra_form: Extra information describing the request body(application/form).
extra_body: Extra information describing the request body(application/json).
responses: Responses model, must be pydantic BaseModel.
responses: response's model must be pydantic BaseModel.
extra_responses: Extra information for responses.
deprecated: Declares this operation to be deprecated.
security: A declaration of which security mechanisms can be used for this operation.
Expand Down Expand Up @@ -210,12 +210,12 @@ def post(
operation_id: Unique string used to identify the operation.
extra_form: Extra information describing the request body(application/form).
extra_body: Extra information describing the request body(application/json).
responses: Responses model, must be pydantic BaseModel.
responses: response's model must be pydantic BaseModel.
extra_responses: Extra information for responses.
deprecated: Declares this operation to be deprecated.
security: A declaration of which security mechanisms can be used for this operation.
servers: An alternative server array to service this operation.
doc_ui: Declares this operation to be show.
doc_ui: Declares this operation to be shown.
"""

def decorator(func) -> Callable:
Expand Down Expand Up @@ -279,12 +279,12 @@ def put(
operation_id: Unique string used to identify the operation.
extra_form: Extra information describing the request body(application/form).
extra_body: Extra information describing the request body(application/json).
responses: Responses model, must be pydantic BaseModel.
responses: response's model must be pydantic BaseModel.
extra_responses: Extra information for responses.
deprecated: Declares this operation to be deprecated.
security: A declaration of which security mechanisms can be used for this operation.
servers: An alternative server array to service this operation.
doc_ui: Declares this operation to be show.
doc_ui: Declares this operation to be shown.
"""

def decorator(func) -> Callable:
Expand Down Expand Up @@ -348,12 +348,12 @@ def delete(
operation_id: Unique string used to identify the operation.
extra_form: Extra information describing the request body(application/form).
extra_body: Extra information describing the request body(application/json).
responses: Responses model, must be pydantic BaseModel.
responses: response's model must be pydantic BaseModel.
extra_responses: Extra information for responses.
deprecated: Declares this operation to be deprecated.
security: A declaration of which security mechanisms can be used for this operation.
servers: An alternative server array to service this operation.
doc_ui: Declares this operation to be show.
doc_ui: Declares this operation to be shown.
"""

def decorator(func) -> Callable:
Expand Down Expand Up @@ -417,12 +417,12 @@ def patch(
operation_id: Unique string used to identify the operation.
extra_form: Extra information describing the request body(application/form).
extra_body: Extra information describing the request body(application/json).
responses: Responses model, must be pydantic BaseModel.
responses: response's model must be pydantic BaseModel.
extra_responses: Extra information for responses.
deprecated: Declares this operation to be deprecated.
security: A declaration of which security mechanisms can be used for this operation.
servers: An alternative server array to service this operation.
doc_ui: Declares this operation to be show.
doc_ui: Declares this operation to be shown.
"""

def decorator(func) -> Callable:
Expand Down
2 changes: 1 addition & 1 deletion flask_openapi3/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def parse_parameters(
parameters.extend(_parameters)
components_schemas.update(**_components_schemas)
if path:
# get args from route path
# get args from a route path
_parameters, _components_schemas = parse_path(path)
parameters.extend(_parameters)
components_schemas.update(**_components_schemas)
Expand Down
4 changes: 2 additions & 2 deletions flask_openapi3/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ def doc(
operation_id: Unique string used to identify the operation.
extra_form: Extra information describing the request body(application/form).
extra_body: Extra information describing the request body(application/json).
responses: Responses model, must be pydantic BaseModel.
responses: response's model must be pydantic BaseModel.
extra_responses: Extra information for responses.
deprecated: Declares this operation to be deprecated.
security: A declaration of which security mechanisms can be used for this operation.
servers: An alternative server array to service this operation.
doc_ui: Declares this operation to be show.
doc_ui: Declares this operation to be shown.
"""

if responses is None:
Expand Down
2 changes: 2 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[mypy]
plugins = pydantic.mypy

0 comments on commit 103ef5c

Please sign in to comment.