This is an automated email from the ASF dual-hosted git repository.
liugddx pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new 1455505e90 [Improve][rest api] improve rest-api doc (#7804)
1455505e90 is described below
commit 1455505e90cb8eeb8969bc71d5c090831ebc4263
Author: Guangdong Liu <[email protected]>
AuthorDate: Fri Oct 11 07:46:41 2024 +0800
[Improve][rest api] improve rest-api doc (#7804)
---
docs/en/seatunnel-engine/rest-api-v1.md | 7 +-
.../contribution/how-to-create-your-connector.md | 2 +-
.../{rest-api.md => rest-api-v1.md} | 6 +-
.../api/connector/MarkdownHeaderTest.java | 107 +++++++++++++++++++++
tools/dependencies/known-dependencies.txt | 2 +-
5 files changed, 117 insertions(+), 7 deletions(-)
diff --git a/docs/en/seatunnel-engine/rest-api-v1.md
b/docs/en/seatunnel-engine/rest-api-v1.md
index d6e5baa052..674542c23e 100644
--- a/docs/en/seatunnel-engine/rest-api-v1.md
+++ b/docs/en/seatunnel-engine/rest-api-v1.md
@@ -2,12 +2,13 @@
sidebar_position: 11
---
-**Notes:**
+# RESTful API V1
-It is recommended to use the v2 version of the Rest API. The v1 version is
deprecated and will be removed in the future.
+:::caution warn
+It is recommended to use the v2 version of the Rest API. The v1 version is
deprecated and will be removed in the future.
-# RESTful API V1
+:::
SeaTunnel has a monitoring API that can be used to query status and statistics
of running jobs, as well as recent
completed jobs. The monitoring API is a RESTful API that accepts HTTP requests
and responds with JSON data.
diff --git a/docs/zh/contribution/how-to-create-your-connector.md
b/docs/zh/contribution/how-to-create-your-connector.md
index 3aef1b140c..c8157fbb99 100644
--- a/docs/zh/contribution/how-to-create-your-connector.md
+++ b/docs/zh/contribution/how-to-create-your-connector.md
@@ -1,4 +1,4 @@
-## 开发自己的Connector
+# 开发自己的Connector
如果你想针对SeaTunnel新的连接器API开发自己的连接器(Connector
V2),请查看[这里](https://github.com/apache/seatunnel/blob/dev/seatunnel-connectors-v2/README.zh.md)
。
diff --git a/docs/zh/seatunnel-engine/rest-api.md
b/docs/zh/seatunnel-engine/rest-api-v1.md
similarity index 99%
rename from docs/zh/seatunnel-engine/rest-api.md
rename to docs/zh/seatunnel-engine/rest-api-v1.md
index 45b0a5bf1e..639a7318cd 100644
--- a/docs/zh/seatunnel-engine/rest-api.md
+++ b/docs/zh/seatunnel-engine/rest-api-v1.md
@@ -2,11 +2,13 @@
sidebar_position: 11
---
-**注意:**
+# RESTful API
+
+:::caution warn
推荐使用v2版本的Rest API。 v1 版本已弃用,并将在将来删除。
-# RESTful API
+:::
SeaTunnel有一个用于监控的API,可用于查询运行作业的状态和统计信息,以及最近完成的作业。监控API是RESTful风格的,它接受HTTP请求并使用JSON数据格式进行响应。
diff --git
a/seatunnel-dist/src/test/java/org/apache/seatunnel/api/connector/MarkdownHeaderTest.java
b/seatunnel-dist/src/test/java/org/apache/seatunnel/api/connector/MarkdownHeaderTest.java
new file mode 100644
index 0000000000..d4dbdf790c
--- /dev/null
+++
b/seatunnel-dist/src/test/java/org/apache/seatunnel/api/connector/MarkdownHeaderTest.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.api.connector;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class MarkdownHeaderTest {
+
+ private static final List<Path> docsDirectorys = new ArrayList<>();
+
+ @BeforeAll
+ public static void setup() {
+ docsDirectorys.add(Paths.get("..", "docs", "en"));
+ docsDirectorys.add(Paths.get("..", "docs", "zh"));
+ }
+
+ @Test
+ public void testPrimaryHeadersHaveNoTextAbove() {
+ docsDirectorys.forEach(
+ docsDirectory -> {
+ try (Stream<Path> paths = Files.walk(docsDirectory)) {
+ List<Path> mdFiles =
+ paths.filter(Files::isRegularFile)
+ .filter(path ->
path.toString().endsWith(".md"))
+ .collect(Collectors.toList());
+
+ for (Path mdPath : mdFiles) {
+ List<String> lines = Files.readAllLines(mdPath,
StandardCharsets.UTF_8);
+
+ String firstRelevantLine = null;
+ int lineNumber = 0;
+ boolean inFrontMatter = false;
+
+ for (int i = 0; i < lines.size(); i++) {
+ String line = lines.get(i).trim();
+ lineNumber = i + 1;
+
+ if (i == 0 && line.equals("---")) {
+ inFrontMatter = true;
+ continue;
+ }
+ if (inFrontMatter) {
+ if (line.equals("---")) {
+ inFrontMatter = false;
+ }
+ continue;
+ }
+
+ if (line.isEmpty()) {
+ continue;
+ }
+
+ if (line.startsWith("import ")) {
+ continue;
+ }
+
+ firstRelevantLine = line;
+ break;
+ }
+
+ if (firstRelevantLine == null) {
+ Assertions.fail(
+ String.format(
+ "The file %s is empty and has
no content.",
+ mdPath));
+ }
+
+ if (!firstRelevantLine.startsWith("# ")) {
+ Assertions.fail(
+ String.format(
+ "The first line of the file %s
is not a first level heading. First line content: “%s” (line number: %d)",
+ mdPath, firstRelevantLine,
lineNumber));
+ }
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ });
+ }
+}
diff --git a/tools/dependencies/known-dependencies.txt
b/tools/dependencies/known-dependencies.txt
index 921febcd9b..72b2ef03f6 100755
--- a/tools/dependencies/known-dependencies.txt
+++ b/tools/dependencies/known-dependencies.txt
@@ -69,4 +69,4 @@ jetty-util-9.4.20.v20190813.jar
jetty-util-9.4.56.v20240826.jar
jetty-util-ajax-9.4.56.v20240826.jar
javax.servlet-api-3.1.0.jar
-seatunnel-jetty9-9.4.56-2.3.8-SNAPSHOT-optional.jar
\ No newline at end of file
+seatunnel-jetty9-9.4.56-2.3.8-SNAPSHOT-optional.jar