davidszotten / speccify

Tie together `drf-spectacular` and `djangorestframework-dataclasses` for easy-to-use apis and openapi schemas.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Speccify

Tie together drf-spectacular and djangorestframework-dataclasses for easy-to-use apis and openapi schemas.

Usage

    @dataclass
    class MyQueryData():
        name: str

    @dataclass
    class MyResponse:
        length: int

    @speccify.api_view(methods=["GET"], permissions=[])
    def my_view(request: Request, my_query: Query[MyQueryData]) -> MyResponse:
        name = my_query.name
        length = len(name)
        return MyResponse(length=length)

License

Apache2

About

Tie together `drf-spectacular` and `djangorestframework-dataclasses` for easy-to-use apis and openapi schemas.

License:Apache License 2.0


Languages

Language:Python 100.0%