{"id":13288472,"url":"https://github.com/SMLTTECH/django-asyncapi","last_synced_at":"2025-03-10T06:33:32.876Z","repository":{"id":218960801,"uuid":"736733701","full_name":"SMLTTECH/django-asyncapi","owner":"SMLTTECH","description":"AsyncAPI ✨ documentation in django via pydantic models","archived":false,"fork":false,"pushed_at":"2024-07-20T17:29:42.000Z","size":1203,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-29T16:59:28.372Z","etag":null,"topics":["asyncapi","django","pydantic","python"],"latest_commit_sha":null,"homepage":"https://skonik.github.io/django-asyncapi/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SMLTTECH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-12-28T18:06:56.000Z","updated_at":"2024-07-24T12:03:47.000Z","dependencies_parsed_at":"2024-01-24T18:49:34.650Z","dependency_job_id":"d18719b0-d9a6-4e4d-a11d-4d62b65c02c1","html_url":"https://github.com/SMLTTECH/django-asyncapi","commit_stats":null,"previous_names":["skonik/django-asyncapi","smlttech/django-asyncapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMLTTECH%2Fdjango-asyncapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMLTTECH%2Fdjango-asyncapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMLTTECH%2Fdjango-asyncapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMLTTECH%2Fdjango-asyncapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SMLTTECH","download_url":"https://codeload.github.com/SMLTTECH/django-asyncapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242805420,"owners_count":20187995,"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":["asyncapi","django","pydantic","python"],"created_at":"2024-07-29T16:56:54.984Z","updated_at":"2025-03-10T06:33:30.250Z","avatar_url":"https://github.com/SMLTTECH.png","language":"Python","readme":"# django-asyncapi\n\nGenerate and host your asyncapi specification using pydantic models\n\n\n## Installation\n\nInstall `django-asyncapi` using `pip` or `poetry`:\n\n```\npoetry add django-asyncapi\n```\n\n## Usage\n\n1. Create specification\n\n```python\n\nfrom asyncapi_container.asyncapi.spec.v3.info import Info\nfrom asyncapi_container.containers.v3.simple_spec import SimpleSpecV3\nfrom asyncapi_container.custom_types import RoutingMap\nfrom pydantic import BaseModel, Field\n\n\nclass Customer(BaseModel):\n    first_name: str = Field(..., title='First Name')\n    last_name: str = Field(..., title='Last Name')\n    email: str = Field(..., title='Email')\n    country: str = Field(..., title='Country')\n    zipcode: str = Field(..., title='Zipcode')\n    city: str = Field(..., title='City')\n    street: str = Field(..., title='Street')\n    apartment: str = Field(..., title='Apartment')\n\n\nclass OrderSchemaV1(BaseModel):\n    product_id: int = Field(..., title='Product Id')\n    quantity: int = Field(..., title='Quantity')\n    customer: Customer\n\n\nclass MySpecialServiceAsyncAPISpecV3(SimpleSpecV3):\n    info: Info = Info(\n        title=\"My special Service\",\n        version=\"1.0.0\",\n        description=\"Service for making orders\"\n    )\n    sends: RoutingMap = {\n        \"shop.orders.v1\": [\n            OrderSchemaV1,\n        ]\n    }\n    receives: RoutingMap = {}\n\n```\n\n`\"shop.orders.v1\"` means topic to which our service produces(sends) message described as `OrderSchemaV1` pydantic model.\n\n2. Add `djanog-asyncapi` to `INSTALLED_APPS`\n```python \nINSTALLED_APPS = [\n    ...,\n    \"django_asyncapi\",\n]\n```\n\n3. Setup configuration inside `settings.py`\n```python\n\nDJANGO_ASYNCAPI = {\n    \"ASYNCAPI_SPEC_CLASS\": \"bus.routing.MySpecialServiceAsyncAPISpecV3\",\n}\n \n```\n\n4. Add `django-asyncapi` urls\n\n```python\nfrom django.urls import path, include\n\nurlpatterns = [\n    path('docs/', include('django_asyncapi.urls')),\n]\n\n```\n\n5. Enjoy your results by opening `docs/asyncapi/v3`\n\n![alt text](docs/assets/img/result.png)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSMLTTECH%2Fdjango-asyncapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSMLTTECH%2Fdjango-asyncapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSMLTTECH%2Fdjango-asyncapi/lists"}