Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
openapi: Add comments on top of various OpenAPI doc files.
Tim Abbottf751acbec579
diff --git a/zerver/openapi/curl_param_value_generators.py b/zerver/openapi/curl_param_value_generators.pyindex 7ecf64802ef..ba9e5caf7d5 100644--- a/zerver/openapi/curl_param_value_generators.py+++ b/zerver/openapi/curl_param_value_generators.py@@ -1,3 +1,11 @@+# Zulip's OpenAPI-based API documentation system is documented at+# https://zulip.readthedocs.io/en/latest/documentation/api.html+#+# This file contains helper functions for generating cURL examples+# based on Zulip's OpenAPI definitions, as well as test setup and+# fetching of appropriate parameter values to use when running the+# cURL examples as part of the tools/test-api test suite.+from functools import wrapsfrom typing import Any, Callable, Dict, List, Optional, Set, Tuplediff --git a/zerver/openapi/javascript_examples.js b/zerver/openapi/javascript_examples.jsindex 7ff6c1412ab..59bf0ea15b8 100644--- a/zerver/openapi/javascript_examples.js+++ b/zerver/openapi/javascript_examples.js@@ -4,6 +4,13 @@/*This file makes use of functional comments in a way that makes thecode confusing with the arrow-body-style lint rule applied.++ Zulip's OpenAPI-based API documentation system is documented at+ https://zulip.readthedocs.io/en/latest/documentation/api.html++ This file contains example code fenced off by comments, and is+ designed to be run as part of Zulip's test-api test suite to verify+ that the documented examples are all correct, runnable code.*/const ExamplesHandler = function () {diff --git a/zerver/openapi/javascript_examples.py b/zerver/openapi/javascript_examples.pyindex 47318cda2ba..7d66b113884 100644--- a/zerver/openapi/javascript_examples.py+++ b/zerver/openapi/javascript_examples.py@@ -1,3 +1,9 @@+# Zulip's OpenAPI-based API documentation system is documented at+# https://zulip.readthedocs.io/en/latest/documentation/api.html+#+# This Python file wraps the test suite for Zulip's JavaScript API+# examples and validates the responses against our OpenAPI definitions.+import jsonimport osimport subprocessdiff --git a/zerver/openapi/markdown_extension.py b/zerver/openapi/markdown_extension.pyindex f26b1fefd4c..8dec9908e0c 100644--- a/zerver/openapi/markdown_extension.py+++ b/zerver/openapi/markdown_extension.py@@ -1,3 +1,10 @@+# Zulip's OpenAPI-based API documentation system is documented at+# https://zulip.readthedocs.io/en/latest/documentation/api.html+#+# This file defines the special Markdown extension that is used to+# render the code examples, example responses, etc. that appear in+# Zulip's public API documentation.+import inspectimport jsonimport rediff --git a/zerver/openapi/openapi.py b/zerver/openapi/openapi.pyindex 09b1389de8e..7210aca173b 100644--- a/zerver/openapi/openapi.py+++ b/zerver/openapi/openapi.py@@ -1,5 +1,10 @@-# Set of helper functions to manipulate the OpenAPI files that define our REST-# API's specification.+# Zulip's OpenAPI-based API documentation system is documented at+# https://zulip.readthedocs.io/en/latest/documentation/api.html+#+# This file contains helper functions to interact with the OpenAPI+# definitions and validate that Zulip's implementation matches what is+# described in our documentation.+import osimport refrom typing import Any, Dict, List, Optional, Setdiff --git a/zerver/openapi/python_examples.py b/zerver/openapi/python_examples.pyindex 0363015e6b1..1df6d28eb56 100644--- a/zerver/openapi/python_examples.py+++ b/zerver/openapi/python_examples.py@@ -1,3 +1,17 @@+# Zulip's OpenAPI-based API documentation system is documented at+# https://zulip.readthedocs.io/en/latest/documentation/api.html+#+# This file defines the Python code examples that appears in Zulip's+# REST API documentation, and also contains a system for running the+# example code as part of the `tools/test-api` test suite.+#+# The actual documentation appears within these blocks:+# # {code_example|start}+# Code here+# # {code_example|end}+#+# Whereas the surrounding code is test setup logic.+import jsonimport osimport sysdiff --git a/zerver/openapi/test_curl_examples.py b/zerver/openapi/test_curl_examples.pyindex bd36c4bcc01..33deb271e31 100644--- a/zerver/openapi/test_curl_examples.py+++ b/zerver/openapi/test_curl_examples.py@@ -1,3 +1,10 @@+# Zulip's OpenAPI-based API documentation system is documented at+# https://zulip.readthedocs.io/en/latest/documentation/api.html+#+# This file contains the top-level logic for testing the cURL examples+# in Zulip's API documentation; the details are in+# zerver.openapi.curl_param_value_generators.+import globimport htmlimport json