From bb45d1c416e79a2289efe59a6ed3653fb93813fd Mon Sep 17 00:00:00 2001 From: huangsong Date: Mon, 15 Nov 2021 10:22:45 +0800 Subject: [PATCH] add readme --- README.md | 20 +++++++++++++------- pyproject.toml | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0458348..b2a37c6 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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(...) @@ -90,16 +96,16 @@ http://yourhost/swagger/docs/{tag} -> show the swagger which include tag How to export the swagger ``` -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 ``` diff --git a/pyproject.toml b/pyproject.toml index a6d1cb0..be1a93d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] classifiers = [