Replies: 1 comment
|
Hi @chibx! I'm Dosu and I'm helping the Open Circle team. You're on the right track with your second approach! The key insight is that To provide input-type examples, place export const CreateSubscriptionSchema = v.object({
planId: v.pipe(
v.string(),
v.examples(["12345"]), // before toBigint → expects string ✅
v.toBigint("Invalid plan id")
),
cardId: v.optional(v.pipe(v.string(), v.examples(["54321"]))),
callbackUrl: v.pipe(
v.string(),
v.regex(httpRegex, "Invalid callback url"),
v.examples(["https://example.com/callback"])
),
});Since To reply, just mention @dosu. Docs are dead. Just use Dosu. |
Uh oh!
There was an error while loading. Please reload this page.
Hey, this is my first time in a discussion here 👋🏼
I am building a server with Elysia.js and I am using its OpenAPI adapter with Valibot's JSON Schema mapper
The issue I am facing stems from my attempt to add examples using input types. For example
I got to learn that
v.examples()takes in values similar to the result of v.InferOutput which is logically speaking for validation result (and response typing in Elysia), but I want to build my OpenAPI docs using the request body (Input) typesIf I pass in a string to my
planIdfield instead of a bigint, v.examples() will yell at me, so is there a way to configure v.examples to store inputs for a particular schema, or should I have done the below instead:Please I would love to know if there's anything I am doing wrong
All reactions