Maillol / aiohttp-pydantic

Aiohttp View that validates request body and query sting regarding the annotations declared in the View method
MIT License
67 stars 21 forks source link

Error for typed query or headers parametrs #61

Closed tonal closed 3 months ago

tonal commented 3 months ago

Error generate UI for:

from typing import Annotated
import annotated_types

type ReqIdWhs = Annotated[int, annotated_types.Gt(0), annotated_types.Lt(200)]

class OnlyEnum(StrEnum):
  no_img = auto()
  is_img = auto()
  no_descr = auto()
  no_prop = auto()

type ReqOnly = OnlyEnum|Annotated[frozenset[OnlyEnum], annotated_types.MinLen(1)]

class ViewCatInfo(PydanticView):

  async def get(
    self, site:str, cat_id:int, /, idwhs:ReqIdWhs|None=None, only:ReqOnly|None=None,
    raw:bool=False, no_cache:bool=False,
  ) -> r200[dict]:
    ...