Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

openapi: Add dataclass for holding article path fields.

Suyash Vardhan Mathur1375e99ae7c8
diff --git a/zerver/views/documentation.py b/zerver/views/documentation.py
index 05c2303f95d..33df1acc3e5 100644
--- a/zerver/views/documentation.py
+++ b/zerver/views/documentation.py
@@ -2,7 +2,8 @@ import os
import random
import re
from collections import OrderedDict
-from typing import Any, Dict, Tuple
+from dataclasses import dataclass
+from typing import Any, Dict, Optional, Tuple
from django.conf import settings
from django.http import HttpRequest, HttpResponse, HttpResponseNotFound
@@ -19,6 +20,14 @@ from zerver.models import Realm
from zerver.openapi.openapi import get_endpoint_from_operationid, get_openapi_summary
+@dataclass
+class DocumentationArticle:
+ article_path: str
+ article_http_status: int
+ endpoint_path: Optional[str]
+ endpoint_method: Optional[str]
+
+
def add_api_uri_context(context: Dict[str, Any], request: HttpRequest) -> None:
context.update(zulip_default_context(request))