Skip to content

Commit

Permalink
feature: adding health check view and doc endpoint (#391)
Browse files Browse the repository at this point in the history
* feature: adding health check view and doc endpoint
  • Loading branch information
AlanJaeger authored Aug 15, 2024
1 parent 4d404fa commit 714dae3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
Empty file.
16 changes: 16 additions & 0 deletions chats/apps/api/v1/swagger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework import permissions

schema_view = get_schema_view(
openapi.Info(
title="Weni Chats API",
default_version="v1",
description="-",
terms_of_service="https://weni.ai/termos-de-uso/",
contact=openapi.Contact(email="[email protected]"),
license=openapi.License(name="GPL-3.0"),
),
public=True,
permission_classes=[permissions.AllowAny],
)
23 changes: 5 additions & 18 deletions chats/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

import re

from django.conf import settings
Expand All @@ -21,26 +22,12 @@
from django.contrib import admin
from django.urls import path, re_path
from django.views.static import serve
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework import permissions

schema_view = get_schema_view(
openapi.Info(
title="Weni Chats API",
default_version="v1",
description="-",
terms_of_service="https://weni.ai/termos-de-uso/",
contact=openapi.Contact(email="[email protected]"),
license=openapi.License(name="GPL-3.0"),
),
public=True,
permission_classes=[permissions.AllowAny],
)

from chats.apps.api.v1.swagger import schema_view
from django.http import HttpResponse

urlpatterns = [
path("", schema_view.with_ui("redoc", cache_timeout=0), name="schema-redoc"),
path("", lambda _: HttpResponse()),
path("doc/", schema_view.with_ui("redoc", cache_timeout=0), name="schema-redoc"),
path("admin/", admin.site.urls),
path("v1/", include("chats.apps.api.v1.urls")),
]
Expand Down

0 comments on commit 714dae3

Please sign in to comment.