-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
I worked locally to integrate a functionnality like in apistar.
It could be use like this :
from m2core.bases.base_handler import BaseHandler, http_statuses
from m2core.m2core import M2Core
from m2core.validation import types, validators
from tornado import gen
from json.decoder import JSONDecodeError
from sqlalchemy import exc
class Product(types.Type):
name = validators.String(max_length=100)
rating = validators.Integer(minimum=1, maximum=5)
in_stock = validators.Boolean(default=False)
size = validators.String(enum=['small', 'medium', 'large'])
class Item(types.Type):
field = validators.String(max_length=12)
class ValidatorHandler(BaseHandler):
"""Validate params"""
@gen.coroutine
@M2Core.tryex(*exceptions_list)
@M2Core.validate
def post(self, product: Product, i: Item):
print(product)
print(i)Actually it work with query parameters and json body.
Do you think it would be a good idea to integrate it in your repo ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels