This is an automated email from the ASF dual-hosted git repository.
wanghailin 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 73b76c3ad1 [Improve][doc] Add doc name check (#8140)
73b76c3ad1 is described below
commit 73b76c3ad1a36ad1f0b80f1940ef8b925d79671f
Author: Jast <[email protected]>
AuthorDate: Thu Nov 28 10:02:53 2024 +0800
[Improve][doc] Add doc name check (#8140)
---
docs/en/connector-v2/source/{kafka.md => Kafka.md} | 0
.../contribution/how-to-create-your-connector.md | 3 ++
docs/sidebars.js | 1 +
.../{MarkdownHeaderTest.java => MarkdownTest.java} | 51 +++++++++++++++++++++-
4 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/docs/en/connector-v2/source/kafka.md
b/docs/en/connector-v2/source/Kafka.md
similarity index 100%
rename from docs/en/connector-v2/source/kafka.md
rename to docs/en/connector-v2/source/Kafka.md
diff --git a/docs/en/contribution/how-to-create-your-connector.md
b/docs/en/contribution/how-to-create-your-connector.md
new file mode 100644
index 0000000000..b99bc85d99
--- /dev/null
+++ b/docs/en/contribution/how-to-create-your-connector.md
@@ -0,0 +1,3 @@
+# Develop Your Own Connector
+
+If you want to develop your own connector for the new SeaTunnel connector API
(Connector V2), please check
[here](https://github.com/apache/seatunnel/blob/dev/seatunnel-connectors-v2/README.md).
\ No newline at end of file
diff --git a/docs/sidebars.js b/docs/sidebars.js
index 1b213f3ff5..3257181b11 100644
--- a/docs/sidebars.js
+++ b/docs/sidebars.js
@@ -226,6 +226,7 @@ const sidebars = {
'contribution/new-license',
'contribution/coding-guide',
'contribution/contribute-transform-v2-guide',
+ 'contribution/how-to-create-your-connector'
],
},
"faq"
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/MarkdownTest.java
similarity index 67%
rename from
seatunnel-dist/src/test/java/org/apache/seatunnel/api/connector/MarkdownHeaderTest.java
rename to
seatunnel-dist/src/test/java/org/apache/seatunnel/api/connector/MarkdownTest.java
index d4dbdf790c..65e30ca00f 100644
---
a/seatunnel-dist/src/test/java/org/apache/seatunnel/api/connector/MarkdownHeaderTest.java
+++
b/seatunnel-dist/src/test/java/org/apache/seatunnel/api/connector/MarkdownTest.java
@@ -20,6 +20,8 @@ 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 org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@@ -31,7 +33,7 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-public class MarkdownHeaderTest {
+public class MarkdownTest {
private static final List<Path> docsDirectorys = new ArrayList<>();
@@ -41,6 +43,53 @@ public class MarkdownHeaderTest {
docsDirectorys.add(Paths.get("..", "docs", "zh"));
}
+ @Test
+ @DisabledOnOs(OS.WINDOWS)
+ public void testChineseDocFileNameContainsInEnglishVersionDoc() {
+ // Verify that the file names in the English and Chinese directories
are the same.
+ List<String> enFileName =
+ fileName(docsDirectorys.get(0)).stream()
+ .map(path -> path.replace("/en/", "/"))
+ .collect(Collectors.toList());
+ List<String> zhFileName =
+ fileName(docsDirectorys.get(1)).stream()
+ .map(path -> path.replace("/zh/", "/"))
+ .collect(Collectors.toList());
+
+ // Find Chinese files that don't have English counterparts
+ List<String> missingEnglishFiles =
+ zhFileName.stream()
+ .filter(zhFile -> !enFileName.contains(zhFile))
+ .collect(Collectors.toList());
+
+ // If there are files missing English versions, throw an exception
+ if (!missingEnglishFiles.isEmpty()) {
+ StringBuilder errorMessage = new StringBuilder();
+ errorMessage.append(
+ String.format(
+ "Found %d Chinese files without English
versions:\n",
+ missingEnglishFiles.size()));
+
+ missingEnglishFiles.forEach(
+ file ->
+ errorMessage.append(
+ String.format("Missing English version
for: %s\n", file)));
+
+ throw new AssertionError(errorMessage.toString());
+ }
+ }
+
+ private List<String> fileName(Path docDirectory) {
+ try (Stream<Path> paths = Files.walk(docDirectory)) {
+ return paths.filter(Files::isRegularFile)
+ .filter(path -> path.toString().endsWith(".md"))
+ .map(Path::toString)
+ .collect(Collectors.toList());
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
@Test
public void testPrimaryHeadersHaveNoTextAbove() {
docsDirectorys.forEach(