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

young pushed a commit to branch young/feat/service-list-add
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git

commit c0f91b2dd7d47b8bfe7c3f1284f4851ea81b7b21
Author: Skye Young <[email protected]>
AuthorDate: Tue May 6 00:24:17 2025 +0800

    feat: service schema
---
 src/types/schema/apisix/index.ts    |  2 ++
 src/types/schema/apisix/services.ts | 29 +++++++++++++++++++++++++++++
 src/types/schema/apisix/type.ts     |  3 +++
 3 files changed, 34 insertions(+)

diff --git a/src/types/schema/apisix/index.ts b/src/types/schema/apisix/index.ts
index 950366e18..021405442 100644
--- a/src/types/schema/apisix/index.ts
+++ b/src/types/schema/apisix/index.ts
@@ -3,6 +3,7 @@ import { APISIXPlugins } from './plugins';
 import { APISIXGlobalRules } from './global_rules';
 import { APISIXProtos } from './protos';
 import { APISIXRoutes } from './routes';
+import { APISIXServices } from './services';
 import { APISIXStreamRoutes } from './stream_routes';
 import { APISIXUpstreams } from './upstreams';
 import { APISIXPluginMetadata } from './plugin_metadata';
@@ -16,4 +17,5 @@ export const APISIX = {
   ...APISIXGlobalRules,
   ...APISIXPlugins,
   ...APISIXPluginMetadata,
+  ...APISIXServices,
 };
diff --git a/src/types/schema/apisix/services.ts 
b/src/types/schema/apisix/services.ts
new file mode 100644
index 000000000..1040b416a
--- /dev/null
+++ b/src/types/schema/apisix/services.ts
@@ -0,0 +1,29 @@
+import { z } from 'zod';
+import { APISIXCommon } from './common';
+import { APISIXPlugins } from './plugins';
+import { APISIXUpstreams } from './upstreams';
+
+const Service = z
+  .object({
+    plugins: APISIXPlugins.Plugins.optional(),
+    upstream: APISIXUpstreams.Upstream.omit({ id: true }).optional(),
+    upstream_id: z.string().optional(),
+    script: z.string().optional(),
+    enable_websocket: z.boolean().optional(),
+    hosts: z.array(z.string()).optional(),
+  })
+  .merge(APISIXCommon.Basic)
+  .merge(APISIXCommon.Info);
+
+export const APISIXServices = {
+  Service,
+  ServicePost: Service.omit({
+    id: true,
+    create_time: true,
+    update_time: true,
+  }),
+  ServicePut: Service.omit({
+    create_time: true,
+    update_time: true,
+  }),
+};
diff --git a/src/types/schema/apisix/type.ts b/src/types/schema/apisix/type.ts
index d85fc71dd..e4f896afd 100644
--- a/src/types/schema/apisix/type.ts
+++ b/src/types/schema/apisix/type.ts
@@ -33,6 +33,9 @@ export type APISIXType = RawAPISIXType & {
   RespUpstreamDetail: AxiosResponse<
     APISIXDetailResponse<APISIXType['Upstream']>
   >;
+  RespServiceList: AxiosResponse<APISIXListResponse<APISIXType['Service']>>;
+  RespServiceItem: APISIXType['RespServiceList']['data']['list'][number];
+  RespServiceDetail: 
AxiosResponse<APISIXDetailResponse<APISIXType['Service']>>;
   RespProtoList: AxiosResponse<APISIXListResponse<APISIXType['Proto']>>;
   RespProtoItem: APISIXType['RespProtoList']['data']['list'][number];
   RespProtoDetail: AxiosResponse<APISIXDetailResponse<APISIXType['Proto']>>;

Reply via email to