aboutsummaryrefslogtreecommitdiffstats
path: root/pysite/views/tests/index.py
blob: b96590c06e055c9cf7b0bd07ac38f635c2d4363e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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