Migrate MockV1HistoryApi to zod

GitOrigin-RevId: d0fd392e76632e12832fb794d60b50a0835f3756
This commit is contained in:
Eric Mc Sween
2025-07-03 18:12:10 -04:00
committed by Copybot
parent 56f4528860
commit b31ee65a09

View File

@@ -4,7 +4,7 @@ import {
zipAttachment,
prepareZipAttachment,
} from '../../../../app/src/infrastructure/Response.js'
import Joi from 'joi'
import { z } from 'zod'
class MockV1HistoryApi extends AbstractMockApi {
reset() {
@@ -173,10 +173,10 @@ class MockV1HistoryApi extends AbstractMockApi {
})
this.app.post('/api/projects/:project_id/blobs/:hash', (req, res, next) => {
const schema = Joi.object({
copyFrom: Joi.number().required(),
const schema = z.object({
copyFrom: z.coerce.number(),
})
const { error } = schema.validate(req.query)
const { error } = schema.safeParse(req.query)
if (error) {
return res.sendStatus(400)
}