You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Garrett Mills
1029f7eba5
|
3 years ago | |
---|---|---|
src | 3 years ago | |
.env | 3 years ago | |
.gitignore | 3 years ago | |
README.md | 3 years ago | |
package.json | 3 years ago | |
pnpm-lock.yaml | 3 years ago | |
tsconfig.json | 3 years ago |
README.md
Extollo runtime type validation proof-of-concept
You can read more about this proof-of-concept here:
https://garrettmills.dev/blog/2022/01/14/Runtime-Data-Validation-from-TypeScript-Interfaces/
To run it:
pnpm i
pnpm build
The intermediate files are generated in the exbuild/
directory, and the final compiled output is in the lib/
directory.
Access the Zod schema:
node --experimental-repl-await lib/cli.js shell
powered by Extollo, © 2022 Garrett Mills
Access your application using the "app" global.
(extollo) ➤ Home = require('./lib/app/http/controllers/main/Home.controller').Home
[class Home extends Controller]
(extollo) ➤ home = new Home
Home { request: undefined }
(extollo) ➤ home.getValidator().getZod().shape
{
username: ZodString {
spa: [Function (anonymous)],
superRefine: [Function (anonymous)],
_def: { checks: [Array], typeName: 'ZodString' },
transform: [Function: bound ],
default: [Function: bound ],
_regex: [Function (anonymous)],
nonempty: [Function (anonymous)]
},
password: ZodString {
spa: [Function (anonymous)],
superRefine: [Function (anonymous)],
_def: { checks: [Array], typeName: 'ZodString' },
transform: [Function: bound ],
default: [Function: bound ],
_regex: [Function (anonymous)],
nonempty: [Function (anonymous)]
},
rememberMe: ZodOptional {
spa: [Function (anonymous)],
superRefine: [Function (anonymous)],
_def: { innerType: [ZodBoolean], typeName: 'ZodOptional' },
transform: [Function: bound ],
default: [Function: bound ]
}
}