diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts index 59734583a..657729b32 100644 --- a/backend/src/lib/api-docs/constants.ts +++ b/backend/src/lib/api-docs/constants.ts @@ -2199,6 +2199,7 @@ export const AppConnections = { audience: "The unique identifier of the target API you want to access." }, SQL_CONNECTION: { + gatewayId: "The ID of the gateway to use when performing database requests.", host: "The hostname of the database server.", port: "The port number of the database.", database: "The name of the database to connect to.", diff --git a/backend/src/services/app-connection/shared/sql/sql-connection-schemas.ts b/backend/src/services/app-connection/shared/sql/sql-connection-schemas.ts index bfaf6f2bc..8fea2c1fb 100644 --- a/backend/src/services/app-connection/shared/sql/sql-connection-schemas.ts +++ b/backend/src/services/app-connection/shared/sql/sql-connection-schemas.ts @@ -3,7 +3,11 @@ import { z } from "zod"; import { AppConnections } from "@app/lib/api-docs"; export const BaseSqlUsernameAndPasswordConnectionSchema = z.object({ - gatewayId: z.string().optional(), + gatewayId: z + .union([z.string().uuid(), z.literal("")]) + .transform((value) => value || null) + .nullish() + .describe(AppConnections.CREDENTIALS.SQL_CONNECTION.gatewayId), host: z.string().trim().min(1, "Host required").describe(AppConnections.CREDENTIALS.SQL_CONNECTION.host), port: z.coerce.number().describe(AppConnections.CREDENTIALS.SQL_CONNECTION.port), database: z.string().trim().min(1, "Database required").describe(AppConnections.CREDENTIALS.SQL_CONNECTION.database), diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MsSqlConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MsSqlConnectionForm.tsx index 721ff30d4..63ec9f781 100644 --- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MsSqlConnectionForm.tsx +++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MsSqlConnectionForm.tsx @@ -152,7 +152,7 @@ export const MsSqlConnectionForm = ({ appConnection, onSubmit }: Props) => {