question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting Error : Input parser key: "from" must be ZodString

See original GitHub issue

Hey thanks for this library,

I am trying to understand why the value of an input objects must be a ZodString. I get following error : Input parser key: "from" must be ZodString

  input: z.object({
        from: z.number(),
        to: z.number(),
    }),

I read here https://github.com/jlalmes/trpc-openapi/blob/next/README.md that the input object is defined as ZodObject<{ [string]: ZodString }> but openApiSpec also allows number/ integer etc

at least number would be good.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
elmeistercommented, Dec 7, 2022

These days there are plenty of readme and quite a few good modules, which just do what they supposed to do, isn’t it?

2reactions
msalahzcommented, Dec 19, 2022

Can you please add coerce support?

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC: Support number , boolean , Date in query params #44
That makes sense since query params are strings (so you get an error like Input parser key: "limit" must be ZodString ).
Read more >
Zod: create a schema using an existing type - Stack Overflow
I would suggest doing the following: import { z } from 'zod'; import type { Method } from 'axios'; const methods: z. ZodType<Method>...
Read more >
Schema validation in TypeScript with Zod - LogRocket Blog
In this article, you will learn about schema design and validation in Zod and how to run it in a TypeScript codebase at...
Read more >
Data validation with automatic typing using zod - CodeX Team
So that we don't have to maintain both types and code for validation at the ... After running this code, we will get...
Read more >
/README.md | zod@v3-snapshot-2021-01-21 | Deno
Given any Zod schema, you can call its .parse method to check data is valid. ... If there are any unknown keys in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found