Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@api.validate seems to not work with starletee class endpoint #25

Closed
deepalikumar opened this issue Feb 10, 2020 · 2 comments
Closed

@api.validate seems to not work with starletee class endpoint #25

deepalikumar opened this issue Feb 10, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@deepalikumar
Copy link

Hi.

I have this starlette endpoint.

class UserPostListEndpoint(HTTPEndpoint):
    @api.validate(resp=Response(HTTP_200=PostListSchema))
    async def get(self, request):
        user_id = request.path_params["user_id"]
        return UJSONResponse(await get_user_posts(user_id))

This endpoint is mounted as:

    routes = [
        Mount(
            "/api/v1",
            name="v1",
            routes=[
                Route(
                    "/users/{user_id:int}/posts", UserPostListEndpoint, name="user_list"
                )
            ],
        )
    ]

Invoking it throws an exception.

, in run
    result = self.fn(*self.args, **self.kwargs)
TypeError: validate() missing 2 required positional arguments: 'receive' and 'send'

Does this not work with starlette endpoint?

@kemingy kemingy added the enhancement New feature or request label Feb 10, 2020
@kemingy
Copy link
Member

kemingy commented Feb 10, 2020

Currently, this library doesn't support starlette endpoint. This should be a new feature.

@kemingy
Copy link
Member

kemingy commented Feb 15, 2020

@deepalikumar Hi, this should be fixed in the latest version(0.2.7).

@kemingy kemingy closed this as completed Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants