Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ponytailer committed Nov 15, 2021
1 parent a82dd0a commit bb45d1c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,21 @@ schema-validator
from pydantic import BaseModel
from flask import Flask
from schema_validator import FlaskSchema, validate
from quart import Quart
from schema_validator import SchemaValidator
from schema_validator.flask import validate
# from schema_validator.quart import validate
app = Flask(__name__)
# or
app = Quart(__name__)
FlaskSchema(app)
OR
schema = FlaskSchema()
schema = SchemaValidator(app)
schema.init_app(app)
@dataclass
Expand Down Expand Up @@ -61,7 +67,7 @@ schema-validator
def delete():
# balabala
return jsonify(id=1)
@tags("SOME-TAG", "OTHER-TAG") # only for swagger
class View(MethodView):
@validate(...)
Expand Down Expand Up @@ -90,16 +96,16 @@ http://yourhost/swagger/docs/{tag} -> show the swagger which include tag
<summary>How to export the swagger </summary>

```
add command in flask:
add command in flask/quart:
app.cli.add_command(generate_schema_command)
Export all swagger to json file:
- flask schema -o swagger.json
- flask/quart schema -o swagger.json
Export the swagger which include the ACCOUNT tag:
- flask schema -o swagger.json -t ACCOUNT
- flask/quart schema -o swagger.json -t ACCOUNT
```
</details>
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "schema_validator"
version = "0.2.3"
version = "0.2.4"
description = "A flask/quart extension to provide schema validation with pydantic."
authors = ["hs <[email protected]>"]
classifiers = [
Expand Down

0 comments on commit bb45d1c

Please sign in to comment.