diff --git a/tests/unit/__snapshots__/sse.spec.ts.snap b/tests/unit/__snapshots__/sse.spec.ts.snap index 8bddfbb48..8007b48d9 100644 --- a/tests/unit/__snapshots__/sse.spec.ts.snap +++ b/tests/unit/__snapshots__/sse.spec.ts.snap @@ -33,134 +33,59 @@ exports[`SSE > makeResultHandler() > should create ResultHandler describing poss "mimeTypes": [ "text/event-stream", ], - "schema": ZodDiscriminatedUnion { - "_def": { - "discriminator": "event", - "options": [ - { - "_type": "ZodObject", - "shape": { - "data": { + "schema": { + "_type": "ZodDiscriminatedUnion", + "discriminator": "event", + "options": [ + { + "_type": "ZodObject", + "shape": { + "data": { + "_type": "ZodString", + }, + "event": { + "_type": "ZodLiteral", + "value": "test", + }, + "id": { + "_type": "ZodOptional", + "value": { "_type": "ZodString", }, - "event": { - "_type": "ZodLiteral", - "value": "test", - }, - "id": { - "_type": "ZodOptional", - "value": { - "_type": "ZodString", - }, - }, - "retry": { - "_type": "ZodOptional", - "value": { - "_type": "ZodNumber", - }, - }, }, - }, - { - "_type": "ZodObject", - "shape": { - "data": { + "retry": { + "_type": "ZodOptional", + "value": { "_type": "ZodNumber", }, - "event": { - "_type": "ZodLiteral", - "value": "another", - }, - "id": { - "_type": "ZodOptional", - "value": { - "_type": "ZodString", - }, - }, - "retry": { - "_type": "ZodOptional", - "value": { - "_type": "ZodNumber", - }, - }, }, }, - ], - "optionsMap": Map { - "test" => { - "_type": "ZodObject", - "shape": { - "data": { + }, + { + "_type": "ZodObject", + "shape": { + "data": { + "_type": "ZodNumber", + }, + "event": { + "_type": "ZodLiteral", + "value": "another", + }, + "id": { + "_type": "ZodOptional", + "value": { "_type": "ZodString", }, - "event": { - "_type": "ZodLiteral", - "value": "test", - }, - "id": { - "_type": "ZodOptional", - "value": { - "_type": "ZodString", - }, - }, - "retry": { - "_type": "ZodOptional", - "value": { - "_type": "ZodNumber", - }, - }, }, - }, - "another" => { - "_type": "ZodObject", - "shape": { - "data": { + "retry": { + "_type": "ZodOptional", + "value": { "_type": "ZodNumber", }, - "event": { - "_type": "ZodLiteral", - "value": "another", - }, - "id": { - "_type": "ZodOptional", - "value": { - "_type": "ZodString", - }, - }, - "retry": { - "_type": "ZodOptional", - "value": { - "_type": "ZodNumber", - }, - }, }, }, }, - "typeName": "ZodDiscriminatedUnion", - }, - "and": [Function], - "array": [Function], - "catch": [Function], - "default": [Function], - "describe": [Function], - "isNullable": [Function], - "isOptional": [Function], - "nullable": [Function], - "nullish": [Function], - "optional": [Function], - "or": [Function], - "parse": [Function], - "parseAsync": [Function], - "pipe": [Function], - "promise": [Function], - "readonly": [Function], - "refine": [Function], - "refinement": [Function], - "safeParse": [Function], - "safeParseAsync": [Function], - "spa": [Function], - "superRefine": [Function], - "transform": [Function], + ], }, "statusCodes": [ 200, diff --git a/vitest.setup.ts b/vitest.setup.ts index 798340aab..ccd921c07 100644 --- a/vitest.setup.ts +++ b/vitest.setup.ts @@ -68,6 +68,10 @@ const serializers = [ right, })), makeSchemaSerializer(z.ZodUnion, ({ options }) => ({ options })), + makeSchemaSerializer( + z.ZodDiscriminatedUnion, + ({ options, discriminator }) => ({ discriminator, options }), + ), makeSchemaSerializer(z.ZodEffects, ({ _def: { schema: value } }) => ({ value, })),