Comments (7)
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.
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.
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.
+1
not working for
@request_schema(SchemaPost)
@response_schema(SchemaResp)
async def post(self):
...
from aiohttp-apispec.
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.
@maximdanilchenko +1 for this
from aiohttp-apispec.
Hello guys! Do you have any ETA for this feature?
from aiohttp-apispec.
Related Issues (20)
- Validation does not work in schema with two fields HOT 1
- webargs 6 HOT 1
- Incompatibility with apispec 4.0.0 -> schema2parameters() now needs an argument "location" HOT 4
- response_schema decor doesn't respect marshamallow datetimeformat
- Schema for single value? HOT 1
- Installation through conda-forge
- Validation middleware not validating top level fields when using nested dictionaries.
- Bump apispec to 4.6
- [Webargs 6.0+] Validation middleware does not support unknown field behavior specified with a Marshmallow 3 schema HOT 3
- aiohttp-apispec 2.2.1 provides a version of Swagger-UI that is vulnerable to XSS HOT 1
- Release aiohttp-apispec to pypi HOT 2
- Fix failed tests in CI HOT 1
- ImportError: cannot import name 'soft_unicode' from 'markupsafe' HOT 5
- Failed building wheel for aiohttp-apispec HOT 3
- docs: RequestSchema(strict=True) raises TypeError
- Python 3.10 support
- User-provided dumps to build swagger_dict
- Request schema not validating unknown fields in request json HOT 1
- Missing the fields from Response
- Add options to have relative url param.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiohttp-apispec.