Skip to content

How can I define the openapi specs so that I can define the body name in the SDK but have the type be default? #277

Closed Answered by paulwongx
paulwongx asked this question in Q&A
Discussion options

You must be logged in to vote

I realized you have to hint at the date in the openapi method with something like the schema below for the openapi docs to know it's a string but of format date-time.

const schema = z.object({
  createdAt: z.date().openapi({format: "date-time"})
});

Then when using the sdk in the client, the type will be properly inferred as a date

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by paulwongx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant