Giter Club home page Giter Club logo

Comments (7)

thijstriemstra avatar thijstriemstra commented on August 19, 2024

you can use a simple class and route that.

class NewsAPIHandler(object):
    @docs(
        tags=['news'],
        summary='Get news article(s)',
        description='Get news article.'
    )
    @request_schema(GetRequestSchema())
    async def get_article(self, request):
        pass

from aiohttp-apispec.

ALeksandr-Fuze avatar ALeksandr-Fuze commented on August 19, 2024

Yes, but for the router, I should get a callable Requeste or awaitable stream object.
app.router.add_route('*', '/some_api', views. NewsAPIHandler) - will be not work
app.router.add_post('/some_api', views.NewsAPIHandler(). get_article) - looks not good and works only for one HTTP method.

from aiohttp-apispec.

ALeksandr-Fuze avatar ALeksandr-Fuze commented on August 19, 2024

Hm...
It works if a class was decorated:

@docs(
        tags=["mytag"],
        summary="View method summary",
        description="View method description",
    )
class SomeView(web.View):
    async def post(self) -> web.json_response:
        pass

from aiohttp-apispec.

CrazySky2121 avatar CrazySky2121 commented on August 19, 2024

+1

not working for

@request_schema(SchemaPost)
@response_schema(SchemaResp)
async def post(self):
    ...

from aiohttp-apispec.

maximdanilchenko avatar maximdanilchenko commented on August 19, 2024

As ALeksandr-Fuze mentioned it works only for web.View classes for now. I will make a fix to support your case.

from aiohttp-apispec.

allyo-dmytro-smyk avatar allyo-dmytro-smyk commented on August 19, 2024

@maximdanilchenko +1 for this

from aiohttp-apispec.

CrazySky2121 avatar CrazySky2121 commented on August 19, 2024

Hello guys! Do you have any ETA for this feature?

from aiohttp-apispec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.