fix(SW-188): remove refine and validate on transform for hotel schema

This commit is contained in:
Chuma McPhoy
2024-08-19 10:40:03 +02:00
parent 16e0165a6e
commit 172802af2f

View File

@@ -421,18 +421,13 @@ export const getHotelDataSchema = z.object({
data: z.object({
id: z.string(),
type: z.string(), // No enum here but the standard return appears to be "hotels".
language: z
.string()
.refine((val) => toLang(val) !== undefined, {
message: "Invalid language",
})
.transform((val) => {
const lang = toLang(val)
if (!lang) {
throw new Error("Invalid language")
}
return lang
}),
language: z.string().transform((val) => {
const lang = toLang(val)
if (!lang) {
throw new Error("Invalid language")
}
return lang
}),
attributes: z.object({
name: z.string(),
operaId: z.string(),