Merged in fix/SW-1812-include-schema (pull request #1471)
fix(SW-1812): fixes the issue where we receive `null` instead of actual data inside the includeSchema * fix(SW-1812): fixes the issue where we receive `null` instead of actual data inside the includeSchema Approved-by: Matilda Landström
This commit is contained in:
@@ -11,15 +11,19 @@ import {
|
||||
import { additionalDataSchema, transformAdditionalData } from "./additionalData"
|
||||
|
||||
export const includeSchema = z
|
||||
.discriminatedUnion("type", [
|
||||
additionalDataSchema,
|
||||
citySchema,
|
||||
nearbyHotelsSchema,
|
||||
restaurantsSchema,
|
||||
roomCategoriesSchema,
|
||||
.union([
|
||||
z.null(),
|
||||
z.undefined(),
|
||||
z.discriminatedUnion("type", [
|
||||
additionalDataSchema,
|
||||
citySchema,
|
||||
nearbyHotelsSchema,
|
||||
restaurantsSchema,
|
||||
roomCategoriesSchema,
|
||||
]),
|
||||
])
|
||||
.transform((data) => {
|
||||
switch (data.type) {
|
||||
switch (data?.type) {
|
||||
case "additionalData":
|
||||
return transformAdditionalData(data)
|
||||
case "cities":
|
||||
|
||||
Reference in New Issue
Block a user