Aiohttp Apiset
Python library for building aiohttp APIs with Swagger 2.0 validation and automatic routing.

What it is
This site hosts the documentation for aiohttp-apiset, a Python package that integrates Swagger/OpenAPI 2.0 specifications with the aiohttp web framework to automate route creation, request validation, and response serialization.
The library allows developers to define API endpoints either in external YAML or JSON specifications or inline via docstrings, supports mixing both approaches, and provides a Swagger UI for interactive testing. The router extracts path, query, and body parameters, validates them against JSON Schema, and can serialize responses through middleware.
Targeted at Python developers building asynchronous web services with aiohttp who want contract-first development, automatic validation, and living documentation. It suits teams maintaining separate API specifications or those preferring annotation-driven design.
Getting started involves installing via pip, creating a SwaggerRouter instance, adding routes with handlers that include Swagger directives in docstrings, and running the aiohttp application. The documentation includes examples, a directives reference, and a full class hierarchy for advanced customization.
Notable aspects include a long history with frequent releases since 2016, support for both Swagger UI 2 and 3, and versioned documentation hosted on Read the Docs. It fills a niche for aiohttp developers seeking OpenAPI 2.0 compliance without heavy frameworks.
This description was generated by AI from the site's public content and may contain errors.
What you can do there
- Read installation guides
- Browse API reference for SwaggerRouter and related classes
- Learn how to embed Swagger UI in an aiohttp app
- View examples of handler docstring directives
- Check version history and changelog
Who it's for
Python developers building asynchronous REST APIs with aiohttp and OpenAPI 2.0
Frequently asked questions about aiohttp-apiset.readthedocs.io
›What is aiohttp-apiset?
aiohttp-apiset is a Python package that builds routes and validates requests for aiohttp applications using Swagger 2.0 specifications.
›How do I install aiohttp-apiset?
Install it via pip with the command pip install aiohttp-apiset, then import the SwaggerRouter and middleware into your aiohttp project.
›Can I use external Swagger files with aiohttp-apiset?
Yes, the library supports loading specifications from external files and also allows inclusion of other specifications with URL concatenation.
›Does aiohttp-apiset support Swagger UI 3?
Yes, both Swagger UI 2 and 3 branches are available; version 3 can be accessed via a query parameter.
›How does request validation work in aiohttp-apiset?
Parameters are extracted from the request and validated against JSON Schema definitions derived from the Swagger specification.
›What are the supported specification strategies?
Three strategies are supported: foreign specification maintained by another team, specification in code via docstrings, and a mixed approach combining both.
›Where can I find examples for aiohttp-apiset?
The documentation includes an examples section and a quick start example showing a handler with Swagger directives and router setup.
