You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by vi...@apache.org on 2024/03/20 17:28:57 UTC

(pulsar-site) branch rest-api-links created (now a5d1a71ba245)

This is an automated email from the ASF dual-hosted git repository.

visortelle pushed a change to branch rest-api-links
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


      at a5d1a71ba245 User the correct curl URLs in docs

This branch includes the following new commits:

     new a5d1a71ba245 User the correct curl URLs in docs

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(pulsar-site) 01/01: User the correct curl URLs in docs

Posted by vi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

visortelle pushed a commit to branch rest-api-links
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git

commit a5d1a71ba245d44dab19dc1cb8e9bb782c1a5b59
Author: visortelle <vi...@gmail.com>
AuthorDate: Wed Mar 20 21:28:41 2024 +0400

    User the correct curl URLs in docs
---
 docusaurus.config.js | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/docusaurus.config.js b/docusaurus.config.js
index b8d6f18a2502..9fae0ae8b60d 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -121,8 +121,22 @@ const injectLinkParseForEndpoint = ([, info]) => {
     }
   }
 
+  /**
+   * Removes class name from the REST API docs URL
+   * /admin/v2/<anything>/ClassName_methodName => /admin/v2/<anything>/methodName
+   * Context:
+   * - https://github.com/apache/pulsar/issues/21573
+   * - https://github.com/apache/pulsar/pull/19193
+  */
+  function getCurlUrl(path) {
+    const parts = path.split('/');
+    const last = parts[parts.length - 1];
+    const [_, methodName] = last.split('_');
+    return [...parts.slice(0, parts.length - 1), methodName].join('/');
+  }
+
   return {
-    text: method + " " + path,
+    text: method + " " + getCurlUrl(path),
     link: restBaseUrl + "?" + restUrl,
   };
 };