diff --git a/console/atest-ui/src/locales/en.json b/console/atest-ui/src/locales/en.json
index 6e22d3f0..f7e8736f 100644
--- a/console/atest-ui/src/locales/en.json
+++ b/console/atest-ui/src/locales/en.json
@@ -54,6 +54,7 @@
"functionQuery": "Functions Query",
"output": "Output",
"proxy": "Proxy",
+ "logs": "Logs",
"secure": "Secure",
"data": "Data",
"setting": "Setting",
diff --git a/console/atest-ui/src/locales/zh.json b/console/atest-ui/src/locales/zh.json
index 76de5206..5d0185f2 100644
--- a/console/atest-ui/src/locales/zh.json
+++ b/console/atest-ui/src/locales/zh.json
@@ -44,6 +44,7 @@
"history": "测试历史",
"mock": "模拟",
"welcome": "欢迎",
+ "logs": "日志",
"secrets": "凭据",
"stores": "存储",
"parameter": "参数",
diff --git a/console/atest-ui/src/views/MockManager.vue b/console/atest-ui/src/views/MockManager.vue
index 7224ab79..5ff28194 100644
--- a/console/atest-ui/src/views/MockManager.vue
+++ b/console/atest-ui/src/views/MockManager.vue
@@ -26,7 +26,6 @@ API.GetStream((stream) => {
try {
const data = JSON.parse(stream);
logOutput.value += `${data.result.message}`;
- console.log('Received schema:', logOutput.value);
} catch (e) {}
});
@@ -105,26 +104,30 @@ items:
API Prefix:
Port:
-
-
-
-
-
-
-
-
-
-
-
- {{ t('label.logs') }}
-
-
- {{ logOutput }}
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ t('title.logs') }}
+
+
+ {{ logOutput }}
+
+
+
+
diff --git a/docs/api-testing-mock-schema.json b/docs/api-testing-mock-schema.json
index 296b413e..7af68faa 100644
--- a/docs/api-testing-mock-schema.json
+++ b/docs/api-testing-mock-schema.json
@@ -1,94 +1,194 @@
{
- "$schema": "http://json-schema.org/draft-07/schema#",
- "title": "Mock Server Schema",
- "type": "object",
- "properties": {
- "objects": {
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "name": {"type": "string"},
- "initCount": {"type": "integer"},
- "sample": {"type": "string"}
- },
- "required": ["name"]
- }
- },
- "items": {
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "name": {"type": "string"},
- "request": {
- "type": "object",
- "properties": {
- "path": {"type": "string"},
- "method": {"type": "string"},
- "header": {
- "type": "object",
- "additionalProperties": {"type": "string"}
- },
- "body": {"type": "string"}
- },
- "required": ["path"]
- },
- "response": {
- "type": "object",
- "properties": {
- "encoder": {"type": "string"},
- "body": {"type": "string"},
- "header": {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Mock Server Schema",
+ "type": "object",
+ "properties": {
+ "objects": {
+ "type": "array",
+ "items": {
"type": "object",
- "additionalProperties": {"type": "string"}
- },
- "statusCode": {"type": "integer"},
- "bodyData": {"type": "string", "contentEncoding": "base64"}
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "initCount": {
+ "type": "integer"
+ },
+ "sample": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "name"
+ ]
}
- },
- "param": {
- "type": "object",
- "additionalProperties": {"type": "string"}
- }
},
- "required": ["name", "request", "response"]
- }
- },
- "proxies": {
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "path": {"type": "string"},
- "target": {"type": "string"}
+ "items": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1
+ },
+ "request": {
+ "type": "object",
+ "properties": {
+ "path": {
+ "type": "string",
+ "minLength": 1
+ },
+ "method": {
+ "type": "string"
+ },
+ "header": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "body": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "path"
+ ]
+ },
+ "response": {
+ "type": "object",
+ "properties": {
+ "encoder": {
+ "type": "string"
+ },
+ "body": {
+ "type": "string"
+ },
+ "header": {
+ "type": "object",
+ "description": "HTTP response headers. Common headers include 'Content-Type', 'Cache-Control', 'Set-Cookie', etc.",
+ "properties": {
+ "Content-Type": {
+ "type": "string",
+ "description": "The MIME type of the response body"
+ },
+ "Cache-Control": {
+ "type": "string",
+ "description": "Directives for caching mechanisms in both requests and responses"
+ },
+ "Set-Cookie": {
+ "type": "string",
+ "description": "Used to send cookies from the server to the user agent"
+ }
+ },
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "statusCode": {
+ "type": "integer"
+ },
+ "bodyData": {
+ "type": "string",
+ "contentEncoding": "base64"
+ }
+ }
+ },
+ "param": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ },
+ "required": [
+ "name",
+ "request",
+ "response"
+ ]
+ }
},
- "required": ["path", "target"]
- }
- },
- "webhooks": {
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "name": {"type": "string"},
- "timer": {"type": "string"},
- "request": {
- "type": "object",
- "properties": {
- "path": {"type": "string"},
- "method": {"type": "string"},
- "header": {
+ "proxies": {
+ "type": "array",
+ "items": {
"type": "object",
- "additionalProperties": {"type": "string"}
- },
- "body": {"type": "string"}
- },
- "required": ["path"]
- }
+ "properties": {
+ "path": {
+ "type": "string"
+ },
+ "target": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "path",
+ "target"
+ ]
+ }
},
- "required": ["name", "timer", "request"]
- }
+ "webhooks": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1
+ },
+ "timer": {
+ "type": "string",
+ "pattern": "^[0-9].*"
+ },
+ "request": {
+ "type": "object",
+ "properties": {
+ "path": {
+ "type": "string"
+ },
+ "method": {
+ "type": "string"
+ },
+ "header": {
+ "type": "object",
+ "description": "HTTP request headers. Common headers include 'Content-Type', 'Authorization', 'Accept', 'User-Agent', etc.",
+ "properties": {
+ "Content-Type": {
+ "type": "string",
+ "description": "The MIME type of the request body"
+ },
+ "Authorization": {
+ "type": "string",
+ "description": "Authentication credentials for HTTP authentication"
+ },
+ "Accept": {
+ "type": "string",
+ "description": "Media types that are acceptable for the response"
+ },
+ "User-Agent": {
+ "type": "string",
+ "description": "Information about the user agent originating the request"
+ }
+ },
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "body": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "path"
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "timer",
+ "request"
+ ]
+ }
+ }
}
- }
}
diff --git a/docs/constants.go b/docs/constants.go
index 380390e5..15d7e6ab 100644
--- a/docs/constants.go
+++ b/docs/constants.go
@@ -18,6 +18,7 @@ package docs
import (
_ "embed"
"fmt"
+
yamlconv "github.com/ghodss/yaml"
"github.com/xeipuuv/gojsonschema"
)
diff --git a/pkg/server/remote_server.go b/pkg/server/remote_server.go
index c3c077ba..16788328 100644
--- a/pkg/server/remote_server.go
+++ b/pkg/server/remote_server.go
@@ -1425,6 +1425,10 @@ func (s *mockServerController) GetConfig(ctx context.Context, in *Empty) (reply
return
}
func (s *mockServerController) LogWatch(e *Empty, logServer Mock_LogWatchServer) (err error) {
+ logServer.Send(&CommonResult{
+ Success: true,
+ Message: "Mock server log watch started\n",
+ })
for msg := range s.logData {
logServer.Send(&CommonResult{
Success: true,