fix(SW-188): remove refine and validate on transform for hotel schema
This commit is contained in:
@@ -421,18 +421,13 @@ export const getHotelDataSchema = z.object({
|
|||||||
data: z.object({
|
data: z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
type: z.string(), // No enum here but the standard return appears to be "hotels".
|
type: z.string(), // No enum here but the standard return appears to be "hotels".
|
||||||
language: z
|
language: z.string().transform((val) => {
|
||||||
.string()
|
const lang = toLang(val)
|
||||||
.refine((val) => toLang(val) !== undefined, {
|
if (!lang) {
|
||||||
message: "Invalid language",
|
throw new Error("Invalid language")
|
||||||
})
|
}
|
||||||
.transform((val) => {
|
return lang
|
||||||
const lang = toLang(val)
|
}),
|
||||||
if (!lang) {
|
|
||||||
throw new Error("Invalid language")
|
|
||||||
}
|
|
||||||
return lang
|
|
||||||
}),
|
|
||||||
attributes: z.object({
|
attributes: z.object({
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
operaId: z.string(),
|
operaId: z.string(),
|
||||||
|
|||||||
Reference in New Issue
Block a user