aamalev / aiohttp_apiset

Package to build routes using swagger specification
http://aiohttp-apiset.readthedocs.io/
Apache License 2.0
41 stars 9 forks source link

OpenAPI 3.1 and aiohttp 4 support #164

Closed rossnomann closed 9 months ago

rossnomann commented 2 years ago

Now we have models for Swagger 2.0 and OpenAPI 3.1 specification. And there is a compatibility layer for internal usage (e.g. when we want to add a route and read parameters from request in a handler)

Since it is forbidden to inherit aiohttp.web.Application and use custom router, I removed old router in favor of Config.

Also we don't generate specification on the fly anymore. Loader returns data as-is. Handlers with operations described in docstring (if any) must be added to config before Config.setup() call.

TODO:

In future I'd like to add a fastapi-like decorator, which allows to generate specification from code. There is @operation decorator, but currently it does not affect specification. It should work like docstrings. The difference is that we use models from compatibility layer and it is required to implement a converter to a target specification version.

Finally, Swagger-UI still does not support OpenAPI 3.1. May be we should look for an alternative or an additional UI?