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(),
}); |
Beta Was this translation helpful? Give feedback.
Answered by
fabian-hiller
Jul 21, 2024
Replies: 1 comment 2 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. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
zaydek
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.