Skip to content

Typesafe introspection #690

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

Closed
joshuajaco opened this issue Jun 30, 2024 · 1 comment
Closed

Typesafe introspection #690

joshuajaco opened this issue Jun 30, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@joshuajaco
Copy link

Sorry to reopen the introspection discussion again, but I've been wondering if there should be support for introspecting schemas without listing them all in a union yourself.

In the meantime I've created valibot-introspection, which essentially is just a large union of all schemas .

Here's an example of how it could be used to generate constraint validation attributes from a valibot schema: TS Playground

Let me know if this is something you are interested in supporting, or if it should stay as a separate library.

@fabian-hiller
Copy link
Owner

Personally, I recommend specifying GenericSchema and/or any specific schema type you support. This gives you more control over your code and allows you to specify what kind of schema your function supports. Note that we have added an isOfKind and isOfType type guard utility for better DX.

@fabian-hiller fabian-hiller self-assigned this Jul 1, 2024
@fabian-hiller fabian-hiller added enhancement New feature or request question Further information is requested labels Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants