-
Notifications
You must be signed in to change notification settings - Fork 12
feat: use zod for dashboard schema #2346
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
base: main
Are you sure you want to change the base?
Conversation
32c2221
to
5bc4acf
Compare
Do you need full Zod or could you get by with Zod mini? |
5bc4acf
to
d45305a
Compare
Can try zod mini. I'm just trying out zod to see how it works with our schema |
d45305a
to
f88f58b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Moving discussion to Slack.)
35af651
to
6854ce0
Compare
BREAKING CHANGE: new dashboard schema using zod
6854ce0
to
8661c5f
Compare
Preview components from this PR in consuming applicationIn consuming application project install preview versions of shared packages generated by this PR:
|
We’re also considering introducing Zod for runtime schema validation in our Datakit flow editor. Should we add add it as a peer + dev dependency and mark it as external? @adamdehaven WDYT? |
If there aren't versioning issues, sure. |
Summary
Just trying things out.
BREAKING CHANGE: new dashboard schema using zod
Why Zod over json-schema-to-ts + ajv
Runtime validation & parsing built in
Single source of truth
Composability
Better error handling out of the box
Transforms & preprocessing
Great DX
Example of a zod error for a dashboard config with an invalid filter field. Using
z.treeifyError(error)
.