Skip to content

Commit

Permalink
[Improve][rest api] improve rest-api doc (#7804)
Browse files Browse the repository at this point in the history
  • Loading branch information
liugddx authored Oct 10, 2024
1 parent 749b2fe commit 1455505
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 7 deletions.
7 changes: 4 additions & 3 deletions docs/en/seatunnel-engine/rest-api-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/contribution/how-to-create-your-connector.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 开发自己的Connector
# 开发自己的Connector

如果你想针对SeaTunnel新的连接器API开发自己的连接器(Connector V2),请查看[这里](https://github.com/apache/seatunnel/blob/dev/seatunnel-connectors-v2/README.zh.md)

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
sidebar_position: 11
---

**注意:**
# RESTful API

:::caution warn

推荐使用v2版本的Rest API。 v1 版本已弃用,并将在将来删除。

# RESTful API
:::

SeaTunnel有一个用于监控的API,可用于查询运行作业的状态和统计信息,以及最近完成的作业。监控API是RESTful风格的,它接受HTTP请求并使用JSON数据格式进行响应。

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
});
}
}
2 changes: 1 addition & 1 deletion tools/dependencies/known-dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
seatunnel-jetty9-9.4.56-2.3.8-SNAPSHOT-optional.jar

0 comments on commit 1455505

Please sign in to comment.