Fix validate test
This commit is contained in:
parent
2c6df74755
commit
93124d804b
|
@ -15,6 +15,7 @@ import {
|
|||
SearchRowRequest,
|
||||
SearchParams,
|
||||
GetRowResponse,
|
||||
ValidateResponse,
|
||||
} from "@budibase/types"
|
||||
import * as utils from "./utils"
|
||||
import { gridSocket } from "../../../websockets"
|
||||
|
@ -215,11 +216,11 @@ export async function search(ctx: Ctx<SearchRowRequest, SearchRowResponse>) {
|
|||
})
|
||||
}
|
||||
|
||||
export async function validate(ctx: Ctx) {
|
||||
export async function validate(ctx: Ctx<Row, ValidateResponse>) {
|
||||
const tableId = utils.getTableId(ctx)
|
||||
// external tables are hard to validate currently
|
||||
if (isExternalTable(tableId)) {
|
||||
ctx.body = { valid: true }
|
||||
ctx.body = { valid: true, errors: {} }
|
||||
} else {
|
||||
ctx.body = await sdk.rows.utils.validate({
|
||||
row: ctx.request.body,
|
||||
|
|
|
@ -11,3 +11,8 @@ export interface DeleteRow {
|
|||
}
|
||||
|
||||
export type DeleteRowRequest = DeleteRows | DeleteRow
|
||||
|
||||
export interface ValidateResponse {
|
||||
valid: boolean
|
||||
errors: Record<string, any>
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue