From b8958fd3a95641914a0ce3c2eea821f6b355ab78 Mon Sep 17 00:00:00 2001 From: tea artist Date: Sun, 22 Dec 2024 17:06:47 +0800 Subject: [PATCH] fix: illegal path --- packages/openapi/src/dashboard/get.ts | 2 +- packages/openapi/src/dashboard/plugin-get.ts | 2 +- packages/openapi/src/dashboard/plugin-install.ts | 2 +- packages/openapi/src/dashboard/plugin-remove.ts | 2 +- packages/openapi/src/dashboard/plugin-rename.ts | 2 +- packages/openapi/src/dashboard/plugin-update-storage.ts | 2 +- packages/openapi/src/generate.schema.ts | 3 +-- packages/openapi/src/view/plugin-get.ts | 2 +- packages/openapi/src/view/plugin-install.ts | 2 +- packages/openapi/src/view/plugin-update-storage.ts | 2 +- 10 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/openapi/src/dashboard/get.ts b/packages/openapi/src/dashboard/get.ts index 5c9a31fcfc..fbb16faeda 100644 --- a/packages/openapi/src/dashboard/get.ts +++ b/packages/openapi/src/dashboard/get.ts @@ -4,7 +4,7 @@ import { registerRoute, urlBuilder } from '../utils'; import { z } from '../zod'; import { dashboardLayoutSchema, dashboardPluginItemSchema } from './types'; -export const GET_DASHBOARD = 'base/{baseId}/dashboard/{id}'; +export const GET_DASHBOARD = '/base/{baseId}/dashboard/{id}'; export const getDashboardVoSchema = z.object({ id: z.string(), diff --git a/packages/openapi/src/dashboard/plugin-get.ts b/packages/openapi/src/dashboard/plugin-get.ts index c21d5e4c7f..18da7a023b 100644 --- a/packages/openapi/src/dashboard/plugin-get.ts +++ b/packages/openapi/src/dashboard/plugin-get.ts @@ -5,7 +5,7 @@ import { z } from '../zod'; import { pluginInstallStorageSchema } from './types'; export const GET_DASHBOARD_INSTALL_PLUGIN = - 'base/{baseId}/dashboard/{dashboardId}/plugin/{installPluginId}'; + '/base/{baseId}/dashboard/{dashboardId}/plugin/{installPluginId}'; export const getDashboardInstallPluginVoSchema = z.object({ pluginId: z.string(), diff --git a/packages/openapi/src/dashboard/plugin-install.ts b/packages/openapi/src/dashboard/plugin-install.ts index ffc566c066..accbe1110d 100644 --- a/packages/openapi/src/dashboard/plugin-install.ts +++ b/packages/openapi/src/dashboard/plugin-install.ts @@ -3,7 +3,7 @@ import { axios } from '../axios'; import { registerRoute, urlBuilder } from '../utils'; import { z } from '../zod'; -export const DASHBOARD_INSTALL_PLUGIN = 'base/{baseId}/dashboard/{id}/plugin'; +export const DASHBOARD_INSTALL_PLUGIN = '/base/{baseId}/dashboard/{id}/plugin'; export const dashboardInstallPluginRoSchema = z.object({ name: z.string(), diff --git a/packages/openapi/src/dashboard/plugin-remove.ts b/packages/openapi/src/dashboard/plugin-remove.ts index 4acf4961f3..9433cb8185 100644 --- a/packages/openapi/src/dashboard/plugin-remove.ts +++ b/packages/openapi/src/dashboard/plugin-remove.ts @@ -4,7 +4,7 @@ import { registerRoute, urlBuilder } from '../utils'; import { z } from '../zod'; export const DASHBOARD_REMOVE_PLUGIN = - 'base/{baseId}/dashboard/{dashboardId}/plugin/{pluginInstallId}'; + '/base/{baseId}/dashboard/{dashboardId}/plugin/{pluginInstallId}'; export const DashboardRemovePluginRoute: RouteConfig = registerRoute({ method: 'delete', diff --git a/packages/openapi/src/dashboard/plugin-rename.ts b/packages/openapi/src/dashboard/plugin-rename.ts index 93ec9ed71d..2a6ae2c9ae 100644 --- a/packages/openapi/src/dashboard/plugin-rename.ts +++ b/packages/openapi/src/dashboard/plugin-rename.ts @@ -4,7 +4,7 @@ import { registerRoute, urlBuilder } from '../utils'; import { z } from '../zod'; export const DASHBOARD_PLUGIN_RENAME = - 'base/{baseId}/dashboard/{dashboardId}/plugin/{pluginInstallId}/rename'; + '/base/{baseId}/dashboard/{dashboardId}/plugin/{pluginInstallId}/rename'; export const dashboardPluginRenameRoSchema = z.object({ name: z.string(), diff --git a/packages/openapi/src/dashboard/plugin-update-storage.ts b/packages/openapi/src/dashboard/plugin-update-storage.ts index ca2d7e51ec..88dd71bc55 100644 --- a/packages/openapi/src/dashboard/plugin-update-storage.ts +++ b/packages/openapi/src/dashboard/plugin-update-storage.ts @@ -6,7 +6,7 @@ import type { IPluginInstallStorage } from './types'; import { pluginInstallStorageSchema } from './types'; export const DASHBOARD_PLUGIN_UPDATE_STORAGE = - 'base/{baseId}/dashboard/{dashboardId}/plugin/{pluginInstallId}/update-storage'; + '/base/{baseId}/dashboard/{dashboardId}/plugin/{pluginInstallId}/update-storage'; export const dashboardPluginUpdateStorageRoSchema = z.object({ storage: pluginInstallStorageSchema.optional(), diff --git a/packages/openapi/src/generate.schema.ts b/packages/openapi/src/generate.schema.ts index c61f3f2643..f72e9e1904 100644 --- a/packages/openapi/src/generate.schema.ts +++ b/packages/openapi/src/generate.schema.ts @@ -14,8 +14,7 @@ function registerAllRoute() { type: 'http', scheme: 'bearer', }); - const path = routeObj.path.startsWith('/') ? routeObj.path : `/${routeObj.path}`; - registry.registerPath({ ...routeObj, path, security: [{ [bearerAuth.name]: [] }] }); + registry.registerPath({ ...routeObj, security: [{ [bearerAuth.name]: [] }] }); } return registry; } diff --git a/packages/openapi/src/view/plugin-get.ts b/packages/openapi/src/view/plugin-get.ts index d4519b12c2..762e646e05 100644 --- a/packages/openapi/src/view/plugin-get.ts +++ b/packages/openapi/src/view/plugin-get.ts @@ -4,7 +4,7 @@ import { pluginInstallStorageSchema } from '../dashboard'; import { registerRoute, urlBuilder } from '../utils'; import { z } from '../zod'; -export const GET_VIEW_INSTALL_PLUGIN = 'table/{tableId}/view/{viewId}/plugin'; +export const GET_VIEW_INSTALL_PLUGIN = '/table/{tableId}/view/{viewId}/plugin'; export const getViewInstallPluginVoSchema = z.object({ pluginId: z.string(), diff --git a/packages/openapi/src/view/plugin-install.ts b/packages/openapi/src/view/plugin-install.ts index c16bc0f88e..71267db788 100644 --- a/packages/openapi/src/view/plugin-install.ts +++ b/packages/openapi/src/view/plugin-install.ts @@ -3,7 +3,7 @@ import { axios } from '../axios'; import { registerRoute, urlBuilder } from '../utils'; import { z } from '../zod'; -export const VIEW_INSTALL_PLUGIN = 'table/{tableId}/view/plugin'; +export const VIEW_INSTALL_PLUGIN = '/table/{tableId}/view/plugin'; export const viewInstallPluginRoSchema = z.object({ name: z.string().optional(), diff --git a/packages/openapi/src/view/plugin-update-storage.ts b/packages/openapi/src/view/plugin-update-storage.ts index 38076be595..2010337bbd 100644 --- a/packages/openapi/src/view/plugin-update-storage.ts +++ b/packages/openapi/src/view/plugin-update-storage.ts @@ -5,7 +5,7 @@ import { pluginInstallStorageSchema } from '../dashboard'; import { registerRoute, urlBuilder } from '../utils'; import { z } from '../zod'; -export const VIEW_PLUGIN_UPDATE_STORAGE = 'table/{tableId}/view/{viewId}/plugin/{pluginInstallId}'; +export const VIEW_PLUGIN_UPDATE_STORAGE = '/table/{tableId}/view/{viewId}/plugin/{pluginInstallId}'; export const viewPluginUpdateStorageRoSchema = z.object({ storage: pluginInstallStorageSchema.optional(),