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

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
ponytailer committed Sep 29, 2021
1 parent f44caa1 commit fcee749
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions example/example_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from flask import Flask, g
from schema_validator import validate
from dataclasses import dataclass


app = Flask()


@dataclass
class Req:
name: str
age: int


@dataclass
class Response:
name: str


@app.post("/test")
@validate(query=Req, body=Req, responses=Response, tags=["test"])
def new_model():
""" tags only for swagger """
body = g.body_params
query_params = g.query_params
print(body, query_params)
return Response(name=123)


if __name__ == "__main__":
app.run()

0 comments on commit fcee749

Please sign in to comment.