Ecosystem: github-stats-forge — zod/mini as the validator for SVG card query strings
#6593
marcalexiei
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
@stats-forge/github-stats-forge-corerenders GitHub stats as SVG cards.It is the library behind three things:
Everything a caller controls is a query string, and
zod/miniis the only thing that parses it.Each endpoint declares what it accepts:
How is Zod used?
Every param helper is in
api/params.ts.z.pipe(rawParam, z.transform(…))per kind.string | undefinedin, a number,Date, boolean or list out, the renderers get typed values and keep their own defaults.A
rejects(kind, passes)helper words the message from the kind andissue.path, so one table holds every wording.z.input/z.outputcarry the types outward.Partial<z.input<TSchema>>typechecks what a consumer builds, and the allowlist keyed bykeyof z.output<TSchema>makes guarding an undeclared param a compile error.zod/minibecause core ships to the browser: the functional API tree-shakes to the checks used.Suggested description for the "Powered by Zod" section
Source
https://github.com/stats-forge/github-stats-forge
All reactions