Can you generate a schema from the Reflection API? #733
|
I was reading about the reflection API and I was wondering if you serialize the schema as JSON, is it possible to generate a new Valibot schema from the metadata? {
"kind": "schema",
"type": "object",
"expects": "Object",
"async": false,
"entries": {
"bar": {
"kind": "schema",
"type": "string",
"expects": "string",
"async": false
}
}
}Would it be possible to dynamically generate the equivalent of this: const MySchema1 = v.object({
bar: v.string(),
}); |
Answered by
fabian-hiller
Jul 21, 2024
Replies: 2 comments 6 replies
|
Yes, this technically works for most schemas, methods, and actions, but I do not have time to implement it at the moment. Feel free to start a community project for this use case. |
2 replies
Answer selected by
zaydek
|
Hi all, I vibe-coded something like this over the weekend. Let's see where it goes :) |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, this technically works for most schemas, methods, and actions, but I do not have time to implement it at the moment. Feel free to start a community project for this use case.