fix: add fallback for type field in restTabState schema (#4398)

This commit is contained in:
Nivedin
2024-10-03 18:24:07 +05:30
committed by GitHub
parent ebb7eeade4
commit 8535004023

View File

@@ -533,7 +533,7 @@ export const REST_TAB_STATE_SCHEMA = z
z.object({
// !Versioned entity
request: entityReference(HoppRESTRequest),
type: z.literal("request"),
type: z.literal("request").catch("request"),
isDirty: z.boolean(),
saveContext: z.optional(HoppRESTSaveContextSchema),
response: z.optional(z.nullable(HoppRESTResponseSchema)),
@@ -544,7 +544,7 @@ export const REST_TAB_STATE_SCHEMA = z
cancelFunction: z.optional(z.function()),
}),
z.object({
type: z.literal("example-response"),
type: z.literal("example-response").catch("example-response"),
response: HoppRESTRequestResponse,
saveContext: z.optional(HoppRESTSaveContextSchema),
isDirty: z.boolean(),