MCPcopy Index your code
hub / github.com/simstudioai/sim / validateRequestSchema

Function validateRequestSchema

apps/sim/lib/api/server/validation.ts:284–301  ·  view source on GitHub ↗
(
  schema: S,
  data: unknown,
  options?: ParseRequestOptions
)

Source from the content-addressed store, hash-verified

282}
283
284function validateRequestSchema<S extends ApiSchema>(
285 schema: S,
286 data: unknown,
287 options?: ParseRequestOptions
288): ValidationResult<S> {
289 const result = schema.safeParse(data)
290 if (!result.success) {
291 return {
292 success: false,
293 response: options?.validationErrorResponse
294 ? options.validationErrorResponse(result.error)
295 : validationErrorResponse(result.error),
296 error: result.error,
297 }
298 }
299
300 return { success: true, data: result.data }
301}

Callers 1

parseRequestFunction · 0.85

Calls 1

validationErrorResponseFunction · 0.85

Tested by

no test coverage detected