aboutsummaryrefslogtreecommitdiffstats
path: root/pysite/views/tests/index.py
blob: 2a55a1125efe497831360b6ee3207194ed0fd046 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# coding=utf-8

from flask import jsonify
from schema import Schema

from pysite.base_route import RouteView
from pysite.constants import ValidationTypes
from pysite.decorators import api_params


SCHEMA = Schema([{"test": str}])

REQUIRED_KEYS = ["test"]


class TestParamsView(RouteView):
    path = "/testparams"
    name = "testparams"

    @api_params(schema=SCHEMA, validation_type=ValidationTypes.params)
    def post(self, data):
        jsonified = jsonify(data)
        return jsonified