{"id":13501739,"url":"https://github.com/sanic-org/sanic-openapi","last_synced_at":"2025-05-15T19:06:31.788Z","repository":{"id":43417980,"uuid":"78607675","full_name":"sanic-org/sanic-openapi","owner":"sanic-org","description":"Easily document your Sanic API with a UI","archived":false,"fork":false,"pushed_at":"2022-12-16T12:42:33.000Z","size":14418,"stargazers_count":502,"open_issues_count":5,"forks_count":108,"subscribers_count":21,"default_branch":"main","last_synced_at":"2025-05-13T22:35:32.236Z","etag":null,"topics":["openapi","python","sanic","swagger-ui"],"latest_commit_sha":null,"homepage":"https://sanic-openapi.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sanic-org.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":"sanic-org","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2017-01-11T05:59:22.000Z","updated_at":"2025-05-09T02:13:12.000Z","dependencies_parsed_at":"2023-01-29T14:00:19.486Z","dependency_job_id":null,"html_url":"https://github.com/sanic-org/sanic-openapi","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanic-org%2Fsanic-openapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanic-org%2Fsanic-openapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanic-org%2Fsanic-openapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanic-org%2Fsanic-openapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanic-org","download_url":"https://codeload.github.com/sanic-org/sanic-openapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254404357,"owners_count":22065641,"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":["openapi","python","sanic","swagger-ui"],"created_at":"2024-07-31T22:01:48.217Z","updated_at":"2025-05-15T19:06:31.722Z","avatar_url":"https://github.com/sanic-org.png","language":"Python","readme":"⚠️ This package is being replaced by [Sanic Extensions](https://sanicframework.org/en/plugins/sanic-ext/getting-started.html). The project will continue to be monitored, but no new features or major development is anticipated. Sanic Extensions contains a near 1:1 upgrade if you are using Sanic OpenAPI with OAS3. Ask in the [forums](https://community.sanicframework.org/) or [discord server](https://discord.gg/FARQzAEMAA) for questions about upgrading.\n\n# Sanic OpenAPI\n\n[![Build Status](https://travis-ci.com/sanic-org/sanic-openapi.svg?branch=master)](https://travis-ci.com/sanic-org/sanic-openapi)\n[![PyPI](https://img.shields.io/pypi/v/sanic-openapi.svg)](https://pypi.python.org/pypi/sanic-openapi/)\n[![PyPI](https://img.shields.io/pypi/pyversions/sanic-openapi.svg)](https://pypi.python.org/pypi/sanic-openapi/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)\n[![codecov](https://codecov.io/gh/sanic-org/sanic-openapi/branch/master/graph/badge.svg)](https://codecov.io/gh/sanic-org/sanic-openapi)\n\nGive your Sanic API a UI and OpenAPI documentation, all for the price of free!\n\n![Example Swagger UI](docs/_static/images/code-to-ui.png?raw=true \"Swagger UI\")\n\nCheck out [open collective](https://opencollective.com/sanic-org) to learn more about helping to fund Sanic.\n\n\n## Installation\n\n```shell\npip install sanic-openapi\n```\n\nAdd Swagger UI with the OpenAPI spec:\n\n```python\nfrom sanic_openapi import swagger_blueprint\n\napp.blueprint(swagger_blueprint)\n```\n\nYou'll now have a Swagger UI at the URL `/swagger/` and an OpenAPI 2.0 spec at `/swagger/swagger.json`.\nYour routes will be automatically categorized by their blueprints.\n\n## OpenAPI 2\n\nHere is an example to use Sanic-OpenAPI 2:\n\n```python\nfrom sanic import Sanic\nfrom sanic.response import json\nfrom sanic_openapi import openapi2_blueprint\n\napp = Sanic(name=\"AwesomeApi\")\napp.blueprint(openapi2_blueprint)\n\n\n@app.route(\"/\")\nasync def test(request):\n    return json({\"hello\": \"world\"})\n\n\nif __name__ == \"__main__\":\n    app.run(host=\"0.0.0.0\", port=8000)\n\n```\n\nAnd you can get your Swagger document at \u003chttp://localhost:8000/swagger\u003e like this:\n![](docs/_static/images/hello_world_example.png)\n\n## OpenAPI 3\n\n\nHere is an example to use Sanic-OpenAPI 3:\n\n```python\nfrom sanic import Sanic\nfrom sanic.response import json\nfrom sanic_openapi import openapi3_blueprint\n\napp = Sanic(name=\"AwesomeApi\")\napp.blueprint(openapi3_blueprint)\n\n\n@app.route(\"/\")\nasync def test(request):\n    return json({\"hello\": \"world\"})\n\n\nif __name__ == \"__main__\":\n    app.run(host=\"0.0.0.0\", port=8000)\n\n```\n\nAnd you can get your Swagger document at \u003chttp://localhost:8000/swagger\u003e like this:\n![](docs/_static/images3/hello_world_example.png)\n\n## Documentation\n\nPlease check the documentation on [Readthedocs](https://sanic-openapi.readthedocs.io)\n\n## Contribution\n\nAny contribution is welcome. If you don't know how to getting started, please check issues first and check our [Contributing Guide](CONTRIBUTING.md) to start you contribution.\n","funding_links":["https://opencollective.com/sanic-org"],"categories":["Python","Extensions"],"sub_categories":["Development"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanic-org%2Fsanic-openapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanic-org%2Fsanic-openapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanic-org%2Fsanic-openapi/lists"}