-
-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON type #933
Comments
Where would you place to code in the docs? Here is a JSON schema I wrote a few months ago: type Json = string | number | boolean | null | { [key: string]: Json } | Json[];
type LiteralIssue = StringIssue | NumberIssue | BooleanIssue | NullIssue;
type JsonIssue = LiteralIssue | ArrayIssue | RecordIssue;
type JsonSchema = BaseSchema<Json, Json, UnionIssue<JsonIssue> | JsonIssue>;
export const jsonSchema = v.lazy(() =>
v.union([v.string(), v.number(), v.boolean(), v.null_(), v.array(jsonSchema), v.record(v.string(), jsonSchema)])
) as JsonSchema; |
I think I'd expect it under Guides > Advanced. |
We could at it to https://valibot.dev/guides/other/. Feel free to create a PR. I see and DX advantage of adding a |
Adds documentation for a JSON type schema as discussed in fabian-hiller#933
I've created a PR. valibot.dev/guides/other is the perfect spot, right below I understand that shipping a |
Hello, thanks for this great library 👋
I was wondering if you'd be interested in a documentation for a JSON serializable type. That's the type that you can safely serialize and de-serialize via
JSON.parse(JSON.stringify(thing))
. Zod mentions it in their documentation.My suggestion (based on Zod's implementation) would be:
Maybe this could even be included in valibot so that people don't need to copy it.
The text was updated successfully, but these errors were encountered: