Quantcast
Channel: User HMR - Stack Overflow
Viewing all articles
Browse latest Browse all 43

trpc error Input parser must be a ZodObject

$
0
0

I have the following input schema:

const inputSchema = z.union([  z.object({    id: z.string(),  }),  z.object({    key: z.string(),  }),])

This schema works until I do:

import { generateOpenApiDocument } from 'trpc-openapi'const openApiDocument = generateOpenApiDocument(trpcAppRouter, {  title: 'title',  baseUrl: '/route',  version: '0.0.1',})

When I generate pass the route with the input to generateOpenApiDocument then I get the error:

TRPCError: [query.thing.route] - Input parser must be a ZodObject

I guess it's a bug in generateOpenApiDocument that doesn't check the input correctly because it is a ZodObject but I'm not sure how to work around this.


Viewing all articles
Browse latest Browse all 43

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>