forked from apiflask/apiflask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schemas.py
82 lines (50 loc) · 1.42 KB
/
schemas.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from marshmallow import EXCLUDE
from apiflask import Schema
from apiflask.fields import File
from apiflask.fields import Integer
from apiflask.fields import List
from apiflask.fields import String
from apiflask.validators import OneOf
class Foo(Schema):
class Meta:
unknown = EXCLUDE
id = Integer(dump_default=123)
name = String(required=True)
class Bar(Schema):
class Meta:
unknown = EXCLUDE
id2 = Integer(dump_default=123)
name2 = String(required=True)
class Baz(Schema):
id = Integer(dump_default=123)
name = String()
class Query(Schema):
class Meta:
unknown = EXCLUDE
id = Integer(load_default=1)
class Form(Schema):
name = String()
class Files(Schema):
image = File()
class FilesList(Schema):
images = List(File())
class FormAndFiles(Schema):
name = String()
image = File()
class EnumPathParameter(Schema):
image_type = String(validate=OneOf(['jpg', 'png', 'tiff', 'webp']))
class Pagination(Schema):
class Meta:
unknown = EXCLUDE
page = Integer(load_default=1)
per_page = Integer(load_default=10)
class Header(Schema):
class Meta:
unknown = EXCLUDE
foo = String(load_default='bar')
class ValidationError(Schema):
status_code = String(required=True)
message = String(required=True)
class HTTPError(Schema):
status_code = String(required=True)
message = String(required=True)