PyPI |
---|
Linux | Windows |
---|---|
tornado-swagger: Swagger API Documentation builder for tornado server. Inspired byaiohttp-swaggerpackage (based on this package sources).
Documentation | https://github.com/mrk-andreev/tornado-swagger/wiki |
Code | https://github.com/mrk-andreev/tornado-swagger |
Issues | https://github.com/mrk-andreev/tornado-swagger/issues |
Python version | Python 3.7, 3.8, 3.9, 3.10, 3.11 nightly |
Swagger Language Specification | https://swagger.io/specification/v2/ |
pip install -U tornado-swagger
tornado-swagger is a plugin for tornado server that allow to document APIs using Swagger show the Swagger-ui console ( default url /api/doc).
import tornado.web
from tornado_swagger.model import register_swagger_model
from tornado_swagger.parameter import register_swagger_parameter
class PostsDetailsHandler(tornado.web.RequestHandler):
def get(self, posts_id):
"""
---
tags:
- Posts
summary: Get posts details
description: posts full version
produces:
- application/json
parameters:
- $ref: '#/parameters/PostId'
responses:
200:
description: list of posts
schema:
$ref: '#/definitions/PostModel'
"""
@register_swagger_parameter
class PostId:
"""
---
name: posts_id
in: path
description: ID of post
required: true
type: string
"""
@register_swagger_model
class PostModel:
"""
---
type: object
description: Post model representation
properties:
id:
type: integer
format: int64
title:
type: string
text:
type: string
is_visible:
type: boolean
default: true
"""
- Add allow_cors option [pull-73](#73) Thanks to
- [@MarkParker5](https://github.com/MarkParker5)
- Specify supported python versions: 3.7, 3.8, 3.9, 3.10, 3.11 and nightly
- Remove flake8-eradicate, flake8-isort from dev deps
- Create make test-in-docker for test application across python versions
- Fix path parsing with groups (skip + warning) [issue-58](#58)
- Update dev requirements (fix broken packages)
- Update PyYAML from PyYAML==5.4 to PyYAML>=5.4 [issue-59](#59)
- Specify encoding in tornado_swagger/setup.py::open
- Fix pypi build (migrate README from md to rst)
- Add experimental openapi support (api_definition_version = API_OPENAPI_3; examples/model_and_param_declaration_openapi3.py)
- Add swagger parameter ref (@register_swagger_parameter). Thanks to [@Weltraumpenner](https://github.com/Weltraumpenner)
- Fix link to spec swagger.json issue.
- Update PyYAML version to 5.4 (Fix for CVE-2020-14343)
- Fix handler args name parsing (
examples/args_recognize.py
). Thanks to [@reubinoff]
- Add
security
to setup. Thanks to [@daominwang](https://github.com/daominwang) - Add black code formatter
- Update swagger-ui library to 3.37.2
- Add integrity attribute to script / link tags
- Remove Python 3.5 support
- Add display_models param to setup (
defaultModelsExpandDepth
). Thanks to [@Sloknatos](https://github.com/Sloknatos) - Fix swagger-ui bundle CVE-2019-17495
- Specify supported python versions: 3.5, 3.6, 3.7, 3.8, nightly
- Fix issue with
StaticFileHandler
(#28)
- Update dependencies
PyYAML==5.3.1
fix vulnerabilitiespytest==6.0.1
,pytest-flake8==1.0.6
fix test crash
- Fix “index out of range issue for StaticFileHandler” (#23)
- Fix
\t
bug in Windows (#21)
- Support wrapped methods
- Remove jinja2 from deps
- Replace local js/css to cdn
- Remove static files serving
- Swagger model definition
- Parameters filling in route path
- Schema definition
export_swagger(routes)
as public function- Update frontend
- First version released