intgr / drf-yasg-stubs

Typing stubs for drf-yasg library (PEP 484 stubs for Mypy and PyCharm)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SchemaView without_ui/with_ui return a function, not ApiView

palfrey opened this issue · comments

In both cases they've called as_cached_view which calls as_view

With the current stubs I get

error: No overload variant of "url" matches argument types "str", "APIView", "str"
note: Possible overload variants:
note:     def url(regex: str, view: Callable[..., HttpResponseBase], kwargs: Dict[str, Any] = ..., name: str = ...) -> URLPattern
note:     def url(regex: str, view: Tuple[List[URLResolver], Optional[str], Optional[str]], kwargs: Dict[str, Any] = ..., name: str = ...) -> URLResolver
note:     def url(regex: str, view: List[Union[URLResolver, str]], kwargs: Dict[str, Any] = ..., name: str = ...) -> URLResolver

They should be marked as returning some sort of Callable variant I think

Thanks, right you are, it returns APIView.as_view() instead of APIView. Sorry it took me so long to get around to this.

I will publish a fix soon.

Closed in #4.

Uploaded version 0.1.1 with this fix and a few others.