{"id":13690351,"url":"https://github.com/Woile/starlette-apispec","last_synced_at":"2025-05-02T06:32:36.104Z","repository":{"id":33490936,"uuid":"158822553","full_name":"woile/starlette-apispec","owner":"woile","description":"Easy integration of APISpec for Starlette","archived":false,"fork":false,"pushed_at":"2024-03-25T04:51:37.000Z","size":84,"stargazers_count":53,"open_issues_count":4,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-22T23:52:08.805Z","etag":null,"topics":["api-documentation","api-rest","openapi","python3","starlette","swagger"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/woile.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-23T11:16:23.000Z","updated_at":"2024-12-16T16:51:33.000Z","dependencies_parsed_at":"2024-01-12T19:48:01.208Z","dependency_job_id":"4069d34b-a392-4267-adb9-344480186f53","html_url":"https://github.com/woile/starlette-apispec","commit_stats":{"total_commits":57,"total_committers":8,"mean_commits":7.125,"dds":0.5789473684210527,"last_synced_commit":"2a971302b934ddcce302f708b740914d28486de4"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woile%2Fstarlette-apispec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woile%2Fstarlette-apispec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woile%2Fstarlette-apispec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woile%2Fstarlette-apispec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/woile","download_url":"https://codeload.github.com/woile/starlette-apispec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251998768,"owners_count":21678007,"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":["api-documentation","api-rest","openapi","python3","starlette","swagger"],"created_at":"2024-08-02T16:01:03.840Z","updated_at":"2025-05-02T06:32:35.716Z","avatar_url":"https://github.com/woile.png","language":"Python","funding_links":[],"categories":["Extensions"],"sub_categories":["API","API (REST, GraphQL...)"],"readme":"==================\nStarlette APISpec\n==================\n\n    Easy APISpec integration for Starlette\n\n\n.. image:: https://github.com/Woile/starlette-apispec/actions/workflows/pythonpackage.yml/badge.svg?style=flat-square\n    :alt: GitHub Workflow Status\n    :target: https://github.com/Woile/starlette-apispec/actions/workflows/pythonpackage.yml\n\n.. image:: https://img.shields.io/codecov/c/github/Woile/starlette-apispec.svg?style=flat-square\n    :alt: Codecov\n    :target: https://codecov.io/gh/Woile/starlette-apispec\n\n.. image:: https://img.shields.io/pypi/v/starlette-apispec.svg?style=flat-square\n    :alt: PyPI\n    :target: https://pypi.org/project/starlette-apispec/\n\n.. image:: https://img.shields.io/pypi/pyversions/starlette-apispec.svg?style=flat-square\n    :alt: PyPI - Python Version\n    :target: https://pypi.org/project/starlette-apispec/\n\n.. contents::\n    :depth: 2\n\n.. code-block:: python\n\n    from apispec import APISpec\n    from apispec.ext.marshmallow import MarshmallowPlugin\n    from starlette.applications import Starlette\n    from starlette_apispec import APISpecSchemaGenerator\n\n    app = Starlette()\n\n    schemas = APISpecSchemaGenerator(\n        APISpec(\n            title=\"Example API\",\n            version=\"1.0\",\n            openapi_version=\"3.0.0\",\n            info={\"description\": \"explanation of the api purpose\"},\n            plugins=[MarshmallowPlugin()],\n        )\n    )\n\n    @app.route(\"/schema\", methods=[\"GET\"], include_in_schema=False)\n    def schema(request):\n        return schemas.OpenAPIResponse(request=request)\n\n\nInstallation\n============\n\n::\n\n    pip install -U starlette-apispec\n\nAlternatively you can do\n\n::\n\n    poetry add starlette-apispec\n\nAbout\n-----\n\nThis library helps you easily document your REST API built with starlette.\n\nStarlette_ is a is a lightweight ASGI framework/toolkit,\nwhich is ideal for building high performance asyncio services.\n\nAPISpec_ supports the `OpenApi Specification \u003chttps://github.com/OAI/OpenAPI-Specification\u003e`_\nand it has some useful plugins like marshmallow_ support.\n\nVersion supported: :code:`^1.0.0`\n\n\nUsage\n=====\n\n\nThis example includes marshmallow_ integration\n\n.. code-block:: python\n\n    from apispec import APISpec\n\n    from starlette.applications import Starlette\n    from starlette.endpoints import HTTPEndpoint\n    from starlette.testclient import TestClient\n\n    from starlette_apispec import APISpecSchemaGenerator\n\n\n    app = Starlette()\n\n    schemas = APISpecSchemaGenerator(\n        APISpec(\n            title=\"Example API\",\n            version=\"1.0\",\n            openapi_version=\"3.0.0\",\n            info={\"description\": \"explanation of the api purpose\"},\n        )\n    )\n\n\n    @app.websocket_route(\"/ws\")\n    def ws(session):\n        \"\"\"ws\"\"\"\n        pass  # pragma: no cover\n\n\n    @app.route(\"/users\", methods=[\"GET\", \"HEAD\"])\n    def list_users(request):\n        \"\"\"\n        responses:\n        200:\n            description: A list of users.\n            examples:\n            [{\"username\": \"tom\"}, {\"username\": \"lucy\"}]\n        \"\"\"\n        pass  # pragma: no cover\n\n\n    @app.route(\"/users\", methods=[\"POST\"])\n    def create_user(request):\n        \"\"\"\n        responses:\n        200:\n            description: A user.\n            examples:\n            {\"username\": \"tom\"}\n        \"\"\"\n        pass  # pragma: no cover\n\n\n    @app.route(\"/orgs\")\n    class OrganisationsEndpoint(HTTPEndpoint):\n        def get(self, request):\n            \"\"\"\n            responses:\n            200:\n                description: A list of organisations.\n                examples:\n                [{\"name\": \"Foo Corp.\"}, {\"name\": \"Acme Ltd.\"}]\n            \"\"\"\n            pass  # pragma: no cover\n\n        def post(self, request):\n            \"\"\"\n            responses:\n            200:\n                description: An organisation.\n                examples:\n                {\"name\": \"Foo Corp.\"}\n            \"\"\"\n            pass  # pragma: no cover\n\n\n    @app.route(\"/schema\", methods=[\"GET\"], include_in_schema=False)\n    def schema(request):\n        return schemas.OpenAPIResponse(request=request)\n\nMore documentation\n==================\n\nThis package is basically a proxy, so if you wonder how to do something,\nhere are the sources you need:\n\n`Starlette documentation`_\n\n`APISpec documentation`_\n\n\nTesting\n=======\n\n1. Clone the repo\n2. Activate venv ``. venv/bin/activate``\n3. Install dependencies\n\n::\n\n    poetry install\n\n4. Run tests\n\n::\n\n    ./scripts/test\n\n\nContributing\n============\n\n**PRs are welcome!**\n\n\n.. _marshmallow: https://marshmallow.readthedocs.io/\n.. _APISpec: https://apispec.readthedocs.io/en/stable/\n.. _Starlette: https://www.starlette.io/\n.. _`Starlette documentation`: https://www.starlette.io/\n.. _`APISpec documentation`: https://apispec.readthedocs.io/en/stable/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWoile%2Fstarlette-apispec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWoile%2Fstarlette-apispec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWoile%2Fstarlette-apispec/lists"}