blob: e696683f8859db467aa46beafd969921b745fed8 (
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
24
25
26
27
28
29
30
|
"""Utilities for providing API payload validation."""
from typing import Optional
from pydantic.fields import Field
from pydantic.main import BaseModel
from spectree import SpecTree
api = SpecTree(
"starlette",
TITLE="Python Discord Forms",
PATH="docs"
)
class ErrorMessage(BaseModel):
error: str = Field(description="The details on the error")
class OkayResponse(BaseModel):
status: str = "ok"
class AuthorizationHeaders(BaseModel):
authorization: Optional[str] = Field(
title="Authorization",
description=(
"The Authorization JWT token received from the "
"authorize route in the format `JWT {token}`"
)
)
|