{"id":16252202,"url":"https://github.com/jsfehler/leangle","last_synced_at":"2025-03-19T20:31:13.453Z","repository":{"id":62575431,"uuid":"246442803","full_name":"jsfehler/leangle","owner":"jsfehler","description":"Add swagger parameter and response documentation to apps built with Chalice","archived":false,"fork":false,"pushed_at":"2020-03-17T16:11:26.000Z","size":69,"stargazers_count":11,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T20:55:12.596Z","etag":null,"topics":["aws","aws-apigateway","chalice","python3","swagger"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsfehler.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-11T01:05:35.000Z","updated_at":"2022-12-02T17:01:07.000Z","dependencies_parsed_at":"2022-11-03T20:44:44.956Z","dependency_job_id":null,"html_url":"https://github.com/jsfehler/leangle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsfehler%2Fleangle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsfehler%2Fleangle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsfehler%2Fleangle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsfehler%2Fleangle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsfehler","download_url":"https://codeload.github.com/jsfehler/leangle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244018738,"owners_count":20384625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-apigateway","chalice","python3","swagger"],"created_at":"2024-10-10T15:12:47.082Z","updated_at":"2025-03-19T20:31:12.794Z","avatar_url":"https://github.com/jsfehler.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"leangle\r\n=======\r\n\r\n.. image:: https://img.shields.io/pypi/v/leangle.svg\r\n    :target: https://pypi.org/project/leangle\r\n    :alt: PyPI\r\n\r\n.. image:: https://img.shields.io/pypi/pyversions/leangle.svg\r\n    :alt: PyPI - Python Version\r\n    :target: https://github.com/jsfehler/leangle\r\n\r\n.. image:: https://img.shields.io/github/license/jsfehler/leangle.svg\r\n    :alt: GitHub\r\n    :target: https://github.com/jsfehler/leangle/blob/master/LICENSE\r\n\r\n.. image:: https://travis-ci.org/jsfehler/leangle.svg?branch=master\r\n    :target: https://travis-ci.org/jsfehler/leangle\r\n\r\n.. image:: https://coveralls.io/repos/github/jsfehler/leangle/badge.svg?branch=master\r\n    :target: https://coveralls.io/github/jsfehler/leangle?branch=master\r\n\r\nAn add-on for `chalice \u003chttps://github.com/aws/chalice\u003e`_ to improve documentation of an API Gateway.\r\n\r\nAs of version 1.13.0, chalice does not support models for the request or response.\r\nThis means any documentation generated for an API Gateway is going to be much less useful.\r\n\r\nleangle improves this with a collection of decorators for chalice route functions, and\r\nbuilt-in support for marshmallow schemas.\r\n\r\nInstallation\r\n------------\r\n\r\nVia pip:\r\n\r\n.. code-block:: bash\r\n\r\n  pip install leangle\r\n\r\n\r\nChalice itself is an optional dependency. This can be useful for testing and validation,\r\nbut should not be used for the version of chalice deployed to AWS.\r\n\r\n.. code-block:: bash\r\n\r\n  pip install leangle[chalice]\r\n\r\n\r\nDescribe API Parameters\r\n------------------------\r\n\r\nAPI Responses can be described with the *describe.parameter* decorator.\r\nThey will be added as documentation to the API Gateway.\r\nThey should go after the route decorator, and can be stacked.\r\n\r\n.. code-block:: python\r\n\r\n    import leangle\r\n\r\n\r\n    @app.route('/', methods=['POST'])\r\n    @leangle.describe.parameter(name='body', _in='body', description='Create a new widget', schema='WidgetSchema')\r\n    def index():\r\n        return Response(status_code=201)\r\n\r\n\r\nDescribing the 'in' field of a parameter\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n*_in* is used, as *in* is a reserved word in Python.\r\n\r\n\r\nDescribe API Responses\r\n------------------------\r\n\r\nAPI Responses can be described with the *describe.response* decorator.\r\nThey will be added as documentation to the API Gateway.\r\nThey should go after the route decorator, and can be stacked.\r\n\r\n.. code-block:: python\r\n\r\n    import leangle\r\n\r\n\r\n    @app.route('/', methods=['POST'])\r\n    @leangle.describe.response(201, description='Created')\r\n    @leangle.describe.response(422, description='Missing Parameter')\r\n    def index():\r\n        return Response(status_code=201)\r\n\r\n\r\nDescribe Method Tags\r\n--------------------\r\n\r\n.. code-block:: python\r\n\r\n    import leangle\r\n\r\n\r\n    @app.route('/', methods=['POST'])\r\n    @leangle.describe.tags([\"x-large\"])\r\n    def index():\r\n        return Response(status_code=201)\r\n\r\n\r\nAdd schemas\r\n~~~~~~~~~~~\r\n\r\nSchema objects can be defined using `marshmallow \u003chttps://github.com/marshmallow-code/marshmallow\u003e`_\r\n\r\nWhen decorated with the *add_schema* decorator, they will be added as models to the API Gateway.\r\n\r\nThe name of these Schema classes can be used in the describe decorators.\r\n\r\n.. code-block:: python\r\n\r\n  import leangle\r\n  from marshmallow import Schema, fields\r\n\r\n\r\n  @leangle.add_schema()\r\n  class BaseSchema(Schema):\r\n      name = fields.Str()\r\n\r\n\r\n  @app.route('/', methods=['POST'])\r\n  @leangle.describe.response(201, description='Created', schema='BaseSchema')\r\n  def index():\r\n      return Response(status_code=201)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsfehler%2Fleangle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsfehler%2Fleangle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsfehler%2Fleangle/lists"}